aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/ldo.c b/ldo.c
index 958b1b7d..c92573d6 100644
--- a/ldo.c
+++ b/ldo.c
@@ -94,10 +94,6 @@ void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) {
94 setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */ 94 setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */
95 break; 95 break;
96 } 96 }
97 case LUA_ERRERR: {
98 setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling"));
99 break;
100 }
101 case LUA_OK: { /* special case only for closing upvalues */ 97 case LUA_OK: { /* special case only for closing upvalues */
102 setnilvalue(s2v(oldtop)); /* no error message */ 98 setnilvalue(s2v(oldtop)); /* no error message */
103 break; 99 break;
@@ -199,6 +195,16 @@ static void correctstack (lua_State *L) {
199/* some space for error handling */ 195/* some space for error handling */
200#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200) 196#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200)
201 197
198
199/* raise an error while running the message handler */
200l_noret luaD_errerr (lua_State *L) {
201 TString *msg = luaS_newliteral(L, "error in error handling");
202 setsvalue2s(L, L->top.p, msg);
203 L->top.p++; /* assume EXTRA_STACK */
204 luaD_throw(L, LUA_ERRERR);
205}
206
207
202/* 208/*
203** Reallocate the stack to a new size, correcting all pointers into it. 209** Reallocate the stack to a new size, correcting all pointers into it.
204** In ISO C, any pointer use after the pointer has been deallocated is 210** In ISO C, any pointer use after the pointer has been deallocated is
@@ -248,7 +254,7 @@ int luaD_growstack (lua_State *L, int n, int raiseerror) {
248 a stack error; cannot grow further than that. */ 254 a stack error; cannot grow further than that. */
249 lua_assert(stacksize(L) == ERRORSTACKSIZE); 255 lua_assert(stacksize(L) == ERRORSTACKSIZE);
250 if (raiseerror) 256 if (raiseerror)
251 luaD_throw(L, LUA_ERRERR); /* error inside message handler */ 257 luaD_errerr(L); /* error inside message handler */
252 return 0; /* if not 'raiseerror', just signal it */ 258 return 0; /* if not 'raiseerror', just signal it */
253 } 259 }
254 else if (n < LUAI_MAXSTACK) { /* avoids arithmetic overflows */ 260 else if (n < LUAI_MAXSTACK) { /* avoids arithmetic overflows */