MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / luaL_getsubtable

Function luaL_getsubtable

3rd/lua-5.4.3/src/lauxlib.c:947–958  ·  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

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

Callers 4

luaL_requirefFunction · 0.85
createclibstableFunction · 0.85
luaopen_packageFunction · 0.85
db_sethookFunction · 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