MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / luaL_getsubtable

Function luaL_getsubtable

src/Chain/libraries/glua/lauxlib.cpp:2953–2964  ·  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

2951** into the stack
2952*/
2953LUALIB_API int luaL_getsubtable(lua_State *L, int idx, const char *fname) {
2954 if (lua_getfield(L, idx, fname) == LUA_TTABLE)
2955 return 1; /* table already there */
2956 else {
2957 lua_pop(L, 1); /* remove previous result */
2958 idx = lua_absindex(L, idx);
2959 lua_newtable(L);
2960 lua_pushvalue(L, -1); /* copy to be left at top */
2961 lua_setfield(L, idx, fname); /* assign new table to field */
2962 return 0; /* false, because did not find table there */
2963 }
2964}
2965
2966
2967/*

Callers 2

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