| 170 | |
| 171 | |
| 172 | l_noret luaD_throw (lua_State *L, int errcode) { |
| 173 | if (L->errorJmp) { /* thread has an error handler? */ |
| 174 | L->errorJmp->status = errcode; /* set status */ |
| 175 | LUAI_THROW(L, L->errorJmp); /* jump to it */ |
| 176 | } |
| 177 | else { /* thread has no error handler */ |
| 178 | L->status = cast_byte(errcode); /* mark it as dead */ |
| 179 | if (G(L)->mainthread->errorJmp) { /* main thread has a handler? */ |
| 180 | setobjs2s(L, G(L)->mainthread->top++, L->top - 1); /* copy error obj. */ |
| 181 | luaD_throw(G(L)->mainthread, errcode); /* re-throw in main thread */ |
| 182 | } |
| 183 | else { /* no handler at all; abort */ |
| 184 | if (G(L)->panic) { /* panic function? */ |
| 185 | lua_unlock(L); |
| 186 | G(L)->panic(L); /* call it (last chance to jump out) */ |
| 187 | } |
| 188 | panic("no error handler"); |
| 189 | } |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | |
| 194 | int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { |
no test coverage detected