[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: C function returning table
- From: Jose Marin <jose_marin2@...>
- Date: Fri, 18 Feb 2005 12:47:38 -0300 (ART)
Hello!
I have a C function that must return a table.
The table is a pure list, like this:
{
"item1",
"item2",
"item3",
}
My doubt is if I must tell the table index when adding
the item, or there is another aproach?
The function is like this:
int thefunc(lua_State *L)
{
lua_newtable(L);
// check parameters ...
for(int i = 1; i <= someValue; i++){
...
lua_pushnumber(L,i); // the index
lua_pushstring(L,someString);
lua_settable(L,-3);
}
return 1;
}
Thanks!
_______________________________________________________
Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. http://br.acesso.yahoo.com/ - Internet rápida e grátis