MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / compat53_findfield

Function compat53_findfield

extlibs/sol3/include/sol/sol.hpp:2701–2722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2699}
2700
2701static int compat53_findfield(lua_State *L, int objidx, int level) {
2702 if (level == 0 || !lua_istable(L, -1))
2703 return 0; /* not found */
2704 lua_pushnil(L); /* start 'next' loop */
2705 while (lua_next(L, -2)) { /* for each pair in table */
2706 if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */
2707 if (lua_rawequal(L, objidx, -1)) { /* found object? */
2708 lua_pop(L, 1); /* remove value (but keep name) */
2709 return 1;
2710 }
2711 else if (compat53_findfield(L, objidx, level - 1)) { /* try recursively */
2712 lua_remove(L, -2); /* remove table (but keep name) */
2713 lua_pushliteral(L, ".");
2714 lua_insert(L, -2); /* place '.' between the two names */
2715 lua_concat(L, 3);
2716 return 1;
2717 }
2718 }
2719 lua_pop(L, 1); /* remove value */
2720 }
2721 return 0; /* not found */
2722}
2723
2724static int compat53_pushglobalfuncname(lua_State *L, lua_Debug *ar) {
2725 int top = lua_gettop(L);

Callers 1

Calls 5

lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
lua_typeFunction · 0.85
lua_rawequalFunction · 0.85
lua_concatFunction · 0.85

Tested by

no test coverage detected