Returning a string table
Posted: 19 May 2013, 19:28
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
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