| 108 | |
| 109 | |
| 110 | static 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 | |
| 125 | LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, |
no test coverage detected