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 /lbaselib.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 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.134 2003/10/07 20:13:41 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.135 2003/10/10 12:57:55 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -78,10 +78,8 @@ static int luaB_tonumber (lua_State *L) { | |||
78 | 78 | ||
79 | static int luaB_error (lua_State *L) { | 79 | static int luaB_error (lua_State *L) { |
80 | int level = luaL_optint(L, 2, 1); | 80 | int level = luaL_optint(L, 2, 1); |
81 | luaL_checkany(L, 1); | 81 | lua_settop(L, 1); |
82 | if (!lua_isstring(L, 1) || level == 0) | 82 | if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ |
83 | lua_pushvalue(L, 1); /* propagate error message without changes */ | ||
84 | else { /* add extra information */ | ||
85 | luaL_where(L, level); | 83 | luaL_where(L, level); |
86 | lua_pushvalue(L, 1); | 84 | lua_pushvalue(L, 1); |
87 | lua_concat(L, 2); | 85 | lua_concat(L, 2); |