how to create nested tables? My approach sadly does not work. I thought that lua_newtable pushes a new table on the stack and if I do lua_settable that should set key value pair, but I was mistaken apparently.
/*
* local transform = GetTransform()
* print("Translation: " .. transform.Translation.x)
*/
lua_newtable(L);
int index = lua_gettop(L);
lua_pushstring(L, "Translation");
{
lua_newtable(L); // Table inside table
lua_pushstring(L, "x");
lua_pushvalue(L, 0);
lua_settable(L, -3);
lua_pushstring(L, "y");
lua_pushvalue(L, 0);
lua_settable(L, -3);
lua_pushstring(L, "z");
lua_pushvalue(L, 0);
lua_settable(L, -3);
}
lua_settable(L, index);