MCPcopy Create free account
hub / github.com/DFHack/dfhack / luaL_getsubtable

Function luaL_getsubtable

depends/lua/src/lauxlib.c:951–962  ·  view source on GitHub ↗

** ensure that stack[idx][fname] has a table and push that table ** into the stack */

Source from the content-addressed store, hash-verified

949** into the stack
950*/
951LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) {
952 if (lua_getfield(L, idx, fname) == LUA_TTABLE)
953 return 1; /* table already there */
954 else {
955 lua_pop(L, 1); /* remove previous result */
956 idx = lua_absindex(L, idx);
957 lua_newtable(L);
958 lua_pushvalue(L, -1); /* copy to be left at top */
959 lua_setfield(L, idx, fname); /* assign new table to field */
960 return 0; /* false, because did not find table there */
961 }
962}
963
964
965/*

Callers 8

OpenPersistentFunction · 0.85
OpenMatinfoFunction · 0.85
OpenPenFunction · 0.85
OpenPenArrayFunction · 0.85
OpenRandomFunction · 0.85
OpenModuleFunction · 0.85
luaL_requirefFunction · 0.85
luaopen_packageFunction · 0.85

Calls 4

lua_getfieldFunction · 0.85
lua_absindexFunction · 0.85
lua_pushvalueFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected