Page 1 of 1

Plugin example Skeleton

Posted: 11 Dec 2018, 16:21
by xanobis
Hello together,

I'm testing with Plugins and using the v_repExtPluginSkeleton as template and i am change only one Part to get
the amount of inArguments

#define LUA_GETDATA_COMMAND "simSkeleton.getData"
void LUA_GETDATA_CALLBACK(SScriptCallBack* p)
{
CStackArray inArguments;
inArguments.buildFromStack(stack);

CStackArray outArguments;
outArguments.pushInt(inArguments.getSize());
outArguments.buildOntoStack(stack);
}

And i'm only get the correct amount when one argument is an string

sim.addStatusbarMessage(simSkeleton.getData("test")) -> 1
sim.addStatusbarMessage(simSkeleton.getData(123)) -> 0
sim.addStatusbarMessage(simSkeleton.getData("test", 123, 456)) -> 3
sim.addStatusbarMessage(simSkeleton.getData(2, 123, 456)) -> 0
sim.addStatusbarMessage(simSkeleton.getData(123, "test", 456)) -> 3

I didn't understand why. Can someone explain this?

Kind regards

Re: Plugin example Skeleton

Posted: 12 Dec 2018, 11:27
by coppelia
Hello,

it seems you just discovered a bug. It should be:

Code: Select all

_doubleValues.resize(s);
instead of:

Code: Select all

_doubleValues.reserve(s); 
in file programming/common/stack/stackArray.cpp, in function buildFromStack. The common repository was corrected.

Thanks for pointing this out!

Cheers