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