Returning a string table

Typically: "How do I... ", "How can I... " questions
Post Reply
Ulrich

Returning a string table

Post 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

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

Re: Returning a string table

Post 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

Post Reply