| 113 | |
| 114 | |
| 115 | l_noret luaD_throw (lua_State *L, int errcode) { |
| 116 | if (L->errorJmp) { /* thread has an error handler? */ |
| 117 | L->errorJmp->status = errcode; /* set status */ |
| 118 | LUAI_THROW(L, L->errorJmp); /* jump to it */ |
| 119 | } |
| 120 | else { /* thread has no error handler */ |
| 121 | global_State *g = G(L); |
| 122 | errcode = luaE_resetthread(L, errcode); /* close all upvalues */ |
| 123 | if (g->mainthread->errorJmp) { /* main thread has a handler? */ |
| 124 | setobjs2s(L, g->mainthread->top.p++, L->top.p - 1); /* copy error obj. */ |
| 125 | luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ |
| 126 | } |
| 127 | else { /* no handler at all; abort */ |
| 128 | if (g->panic) { /* panic function? */ |
| 129 | lua_unlock(L); |
| 130 | g->panic(L); /* call panic function (last chance to jump out) */ |
| 131 | } |
| 132 | abort(); |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | |
| 138 | int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { |
no test coverage detected