diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-10-23 16:06:22 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-10-23 16:06:22 -0200 |
| commit | 275c150b17ffc621deb5f25ddb851ec942760c04 (patch) | |
| tree | 67fb6e6f7ca592f05fa6cd42da3f2d12cacff9bd /lua.c | |
| parent | d6d896b9532b3a88458a882690c56b391e1ecbc3 (diff) | |
| download | lua-275c150b17ffc621deb5f25ddb851ec942760c04.tar.gz lua-275c150b17ffc621deb5f25ddb851ec942760c04.tar.bz2 lua-275c150b17ffc621deb5f25ddb851ec942760c04.zip | |
`error()' (and `error(nil)') generates errors with no error messages
Diffstat (limited to 'lua.c')
| -rw-r--r-- | lua.c | 9 |
1 files changed, 4 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.122 2003/04/03 13:34:42 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.123 2003/05/07 16:02:16 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 | */ |
| @@ -117,10 +117,9 @@ static void l_message (const char *pname, const char *msg) { | |||
| 117 | 117 | ||
| 118 | 118 | ||
| 119 | static int report (int status) { | 119 | static int report (int status) { |
| 120 | const char *msg; | 120 | if (status && !lua_isnil(L, -1)) { |
| 121 | if (status) { | 121 | const char *msg = lua_tostring(L, -1); |
| 122 | msg = lua_tostring(L, -1); | 122 | if (msg == NULL) msg = "(error object is not a string)"; |
| 123 | if (msg == NULL) msg = "(error with no message)"; | ||
| 124 | l_message(progname, msg); | 123 | l_message(progname, msg); |
| 125 | lua_pop(L, 1); | 124 | lua_pop(L, 1); |
| 126 | } | 125 | } |
