This code sets glob.nest.name
to a C function:
lua_getglobal(state, "glob");
lua_getfield(state, -1, "nest");
lua_pushcclosure(state, &func, 0);
lua_setfield(state, -1, "name");
To add others field to glob.nest
, just keep going:
...
lua_pushcclosure(state, &anotherfunc, 0);
lua_setfield(state, -1, "anothername");