MCPcopy Create free account
hub / github.com/F-Stack/f-stack / countlevels

Function countlevels

freebsd/contrib/openzfs/module/lua/lauxlib.c:95–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94
95static int countlevels (lua_State *L) {
96 lua_Debug ar;
97 int li = 1, le = 1;
98 /* find an upper bound */
99 while (lua_getstack(L, le, &ar)) { li = le; le *= 2; }
100 /* do a binary search */
101 while (li < le) {
102 int m = (li + le)/2;
103 if (lua_getstack(L, m, &ar)) li = m + 1;
104 else le = m;
105 }
106 return le - 1;
107}
108
109
110LUALIB_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