Page 1 of 1

Returning a string table

Posted: 19 May 2013, 19:28
by Ulrich
Hi,

I'm trying to return a table of strings in the regular API. I'm setting up the output struct as follows:

p->outputArgCount=1;
p->outputArgTypeAndSize=(simInt*)simCreateBuffer(p->outputArgCount*2*sizeof(simInt));
p->outputArgTypeAndSize[0*2+0]=sim_lua_arg_string|sim_lua_arg_table;
p->outputArgTypeAndSize[0*2+1]=2;

p->outputChar=(simChar*)simCreateBuffer(4*sizeof(simChar));
p->outputChar[0] = 'a';
p->outputChar[1] = '\0';
p->outputChar[2] = 'b';
p->outputChar[3] = '\0';

However the table returned only contains 'a' in the first entry, the second entry is always empty.

Question as always :-) what am I doing wrong here?

Best Ulrich

Re: Returning a string table

Posted: 19 May 2013, 23:10
by coppelia
Hello Ulrich,

You are not doing anything wrong, except that you discovered a bug! It has been fixed now and will be ok for next release (V3.0.4). I'll send you a fixed version earlier.
Sorry about that and thanks for noticing that bug!

Cheers