Let's say I want to set a value (e.g. a function) inside a nested table from the Lua C API.
-- lua.lua
glob = {
nest = {
-- set value in here
}
}
How would I have to set the stack to access the inner table?
Is it just calling gettable multiple times and then a settop, like in the following code?
lua_pushstring(state, "glob");
lua_gettable(state, -1);
lua_pushstring(state, "nest");
lua_gettable(state, -1);
lua_pushcclosure(state, &func, 0);
lua_settop(state, "funkyfunc");
lua_pop(state, 2);
lua_getglobaland thenlua_gettablelua_settop(state, "funkyfunc")?