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