MCPcopy Create free account
hub / github.com/DFHack/dfhack / lastlevel

Function lastlevel

depends/lua/src/lauxlib.c:110–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108
109
110static int lastlevel (lua_State *L) {
111 lua_Debug ar;
112 int li = 1, le = 1;
113 /* find an upper bound */
114 while (lua_getstack(L, le, &ar)) { li = le; le *= 2; }
115 /* do a binary search */
116 while (li < le) {
117 int m = (li + le)/2;
118 if (lua_getstack(L, m, &ar)) li = m + 1;
119 else le = m;
120 }
121 return le - 1;
122}
123
124
125LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1,

Callers 1

luaL_tracebackFunction · 0.85

Calls 1

lua_getstackFunction · 0.85

Tested by

no test coverage detected