MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / luaL_findtable

Function luaL_findtable

ThirdParty/lua/lua/lauxlib.c:784–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

782#if defined(LUA_COMPAT_MODULE)
783
784static const char *luaL_findtable (lua_State *L, int idx,
785 const char *fname, int szhint) {
786 const char *e;
787 if (idx) lua_pushvalue(L, idx);
788 do {
789 e = strchr(fname, '.');
790 if (e == NULL) e = fname + strlen(fname);
791 lua_pushlstring(L, fname, e - fname);
792 if (lua_rawget(L, -2) == LUA_TNIL) { /* no such field? */
793 lua_pop(L, 1); /* remove this nil */
794 lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */
795 lua_pushlstring(L, fname, e - fname);
796 lua_pushvalue(L, -2);
797 lua_settable(L, -4); /* set new table into field */
798 }
799 else if (!lua_istable(L, -1)) { /* field has a non-table value? */
800 lua_pop(L, 2); /* remove table and value */
801 return fname; /* return problematic part of the name */
802 }
803 lua_remove(L, -2); /* remove previous table */
804 fname = e + 1;
805 } while (*e == '.');
806 return NULL;
807}
808
809
810/*

Callers 1

luaL_pushmoduleFunction · 0.85

Calls 5

lua_pushvalueFunction · 0.85
lua_pushlstringFunction · 0.85
lua_rawgetFunction · 0.85
lua_createtableFunction · 0.85
lua_settableFunction · 0.85

Tested by

no test coverage detected