MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / countlevels

Function countlevels

third-party/lua-5.2.4/src/lauxlib.c:101–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99
100
101static int countlevels (lua_State *L) {
102 lua_Debug ar;
103 int li = 1, le = 1;
104 /* find an upper bound */
105 while (lua_getstack(L, le, &ar)) { li = le; le *= 2; }
106 /* do a binary search */
107 while (li < le) {
108 int m = (li + le)/2;
109 if (lua_getstack(L, m, &ar)) li = m + 1;
110 else le = m;
111 }
112 return le - 1;
113}
114
115
116LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1,

Callers 1

luaL_tracebackFunction · 0.85

Calls 1

lua_getstackFunction · 0.70

Tested by

no test coverage detected