Plugin example Skeleton

Typically: "How do I... ", "How can I... " questions
Post Reply
xanobis
Posts: 2
Joined: 10 Apr 2018, 09:59

Plugin example Skeleton

Post by xanobis » 11 Dec 2018, 16:21

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

coppelia
Site Admin
Posts: 7077
Joined: 14 Dec 2012, 00:25

Re: Plugin example Skeleton

Post by coppelia » 12 Dec 2018, 11:27

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

Post Reply