I have a std::list of objects, and I want to give Lua a function that returns its multidimensional positions. So I need to create a table of tables:
{{1,2,3...,512}, {1,2,3...,512},...,512}
lua_newtable(L);
for (int i = 0; i < 512; i++)
{
lua_newtable(L);
lua_pushnumber(L, pos[i]);
lua_rawseti(L, -2, i);
lua_rawseti(L, -2, i+1);
for (int j = 0; j < 512; j++)
{
//pos[i][j]
}
}
I'd try by trial and error, but since I don't know how to debug it for now, I'm really lost.