MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / compat53_countlevels

Function compat53_countlevels

Libs/sol/sol.hpp:3199–3216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3197}
3198
3199static int compat53_countlevels(lua_State* L) {
3200 lua_Debug ar;
3201 int li = 1, le = 1;
3202 /* find an upper bound */
3203 while (lua_getstack(L, le, &ar)) {
3204 li = le;
3205 le *= 2;
3206 }
3207 /* do a binary search */
3208 while (li < le) {
3209 int m = (li + le) / 2;
3210 if (lua_getstack(L, m, &ar))
3211 li = m + 1;
3212 else
3213 le = m;
3214 }
3215 return le - 1;
3216}
3217
3218static int compat53_findfield(lua_State* L, int objidx, int level) {
3219 if (level == 0 || !lua_istable(L, -1))

Callers 1

luaL_tracebackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected