aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/ldo.c b/ldo.c
index 146125a6..b5ae4607 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.32 1999/02/12 19:23:02 roberto Exp roberto $ 2** $Id: ldo.c,v 1.33 1999/02/22 13:51:44 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*/
@@ -235,7 +235,8 @@ void luaD_travstack (int (*fn)(TObject *))
235 235
236static void message (char *s) { 236static void message (char *s) {
237 TObject *em = &(luaS_new("_ERRORMESSAGE")->u.s.globalval); 237 TObject *em = &(luaS_new("_ERRORMESSAGE")->u.s.globalval);
238 if (ttype(em) != LUA_T_NIL) { 238 if (ttype(em) == LUA_T_PROTO || ttype(em) == LUA_T_CPROTO ||
239 ttype(em) == LUA_T_CLOSURE) {
239 *L->stack.top = *em; 240 *L->stack.top = *em;
240 incr_top; 241 incr_top;
241 lua_pushstring(s); 242 lua_pushstring(s);
@@ -246,14 +247,12 @@ static void message (char *s) {
246/* 247/*
247** Reports an error, and jumps up to the available recover label 248** Reports an error, and jumps up to the available recover label
248*/ 249*/
249void lua_error (char *s) 250void lua_error (char *s) {
250{
251 if (s) message(s); 251 if (s) message(s);
252 if (L->errorJmp) 252 if (L->errorJmp)
253 longjmp(*((jmp_buf *)L->errorJmp), 1); 253 longjmp(*((jmp_buf *)L->errorJmp), 1);
254 else { 254 else {
255 lua_pushstring("lua: exit(1). Unable to recover.\n"); 255 message("exit(1). Unable to recover.\n");
256 lua_call("_ALERT");
257 exit(1); 256 exit(1);
258 } 257 }
259} 258}