diff options
| -rw-r--r-- | ldo.c | 20 |
1 files changed, 13 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 2.51 2008/11/06 12:43:51 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.52 2009/02/18 14:52:03 roberto Exp roberto $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -83,13 +83,19 @@ void luaD_throw (lua_State *L, int errcode) { | |||
| 83 | L->errorJmp->status = errcode; | 83 | L->errorJmp->status = errcode; |
| 84 | LUAI_THROW(L, L->errorJmp); | 84 | LUAI_THROW(L, L->errorJmp); |
| 85 | } | 85 | } |
| 86 | else { | 86 | else { /* thread has no error handler */ |
| 87 | L->status = cast_byte(errcode); | 87 | L->status = cast_byte(errcode); /* mark it as dead */ |
| 88 | if (G(L)->panic) { | 88 | if (G(L)->mainthread->errorJmp) { /* main thread has a handler? */ |
| 89 | lua_unlock(L); | 89 | setobjs2s(L, G(L)->mainthread->top++, L->top - 1); /* copy error obj. */ |
| 90 | G(L)->panic(L); | 90 | luaD_throw(G(L)->mainthread, errcode); /* jump to it */ |
| 91 | } | ||
| 92 | else { | ||
| 93 | if (G(L)->panic) { | ||
| 94 | lua_unlock(L); | ||
| 95 | G(L)->panic(L); | ||
| 96 | } | ||
| 97 | exit(EXIT_FAILURE); | ||
| 91 | } | 98 | } |
| 92 | exit(EXIT_FAILURE); | ||
| 93 | } | 99 | } |
| 94 | } | 100 | } |
| 95 | 101 | ||
