MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaL_getsubtable

Function luaL_getsubtable

freebsd/contrib/openzfs/module/lua/lauxlib.c:722–733  ·  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

720** into the stack
721*/
722LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) {
723 lua_getfield(L, idx, fname);
724 if (lua_istable(L, -1)) return 1; /* table already there */
725 else {
726 lua_pop(L, 1); /* remove previous result */
727 idx = lua_absindex(L, idx);
728 lua_newtable(L);
729 lua_pushvalue(L, -1); /* copy to be left at top */
730 lua_setfield(L, idx, fname); /* assign new table to field */
731 return 0; /* false, because did not find table there */
732 }
733}
734
735
736/*

Callers 1

luaL_requirefFunction · 0.85

Calls 4

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

Tested by

no test coverage detected