diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-20 17:40:09 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-20 17:40:09 -0300 |
commit | b449a5e574874f053859db3da18599b8b968e4e9 (patch) | |
tree | 2b7fd07fcc8fd5daa8036adfb40e6a96e6183339 | |
parent | e572dffa1520f0331a0842a069bb17e2730c6575 (diff) | |
download | lua-b449a5e574874f053859db3da18599b8b968e4e9.tar.gz lua-b449a5e574874f053859db3da18599b8b968e4e9.tar.bz2 lua-b449a5e574874f053859db3da18599b8b968e4e9.zip |
more robust when printing error messages
-rw-r--r-- | lua.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.91 2002/06/18 17:12:05 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.92 2002/06/18 17:43:49 roberto Exp roberto $ |
3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -73,9 +73,14 @@ static void report (int status) { | |||
73 | lua_remove(L, -2); /* lease only traceback on stack */ | 73 | lua_remove(L, -2); /* lease only traceback on stack */ |
74 | } | 74 | } |
75 | lua_getglobal(L, "_ALERT"); | 75 | lua_getglobal(L, "_ALERT"); |
76 | lua_pushvalue(L, -2); | 76 | if (lua_isfunction(L, -1)) { |
77 | lua_pcall(L, 1, 0); | 77 | lua_pushvalue(L, -2); |
78 | lua_pop(L, 1); | 78 | lua_pcall(L, 1, 0); |
79 | } | ||
80 | else { | ||
81 | lua_pop(L, 1); | ||
82 | fprintf(stderr, "%s", lua_tostring(L, -1)); | ||
83 | } | ||
79 | } | 84 | } |
80 | } | 85 | } |
81 | 86 | ||