On Thu, Nov 12, 2009 at 5:00 PM, zweifel <
zweifel@gmail.com> wrote:
> Why cant I pass a table inside a table with the following code:
>
> //first table
> lua_newtable(lua_state);
>
> //second table inside the first table
> lua_newtable(lua_state);
>
> lua_pushstring(lua_state, "x"); //key
> lua_pushnumber(lua_state, (double)array[0]); //value
> lua_settable(lua_state, -3);
>
> lua_pushstring(lua_state, "y"); //key
> lua_pushnumber(lua_state, (double)array[1]); //value
> lua_settable(lua_state, -3);
>
> lua_pushstring(lua_state, "z"); //key
> lua_pushnumber(lua_state, (double)array[2]); //value
> lua_settable(lua_state, -3);
>
> //finish the second table and set it as index to the first table
> lua_rawseti(lua_state, -2, index);
>
> //set name of the first table
> lua_setglobal(lua_state, lua_table_name);