| 114 | |
| 115 | |
| 116 | static int lastlevel (lua_State *L) { |
| 117 | lua_Debug ar; |
| 118 | int li = 1, le = 1; |
| 119 | /* find an upper bound */ |
| 120 | while (lua_getstack(L, le, &ar)) { li = le; le *= 2; } |
| 121 | /* do a binary search */ |
| 122 | while (li < le) { |
| 123 | int m = (li + le)/2; |
| 124 | if (lua_getstack(L, m, &ar)) li = m + 1; |
| 125 | else le = m; |
| 126 | } |
| 127 | return le - 1; |
| 128 | } |
| 129 | |
| 130 | |
| 131 | LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, |
no test coverage detected