diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-09-05 14:17:39 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-09-05 14:17:39 -0300 |
| commit | c676f13e1a7dd175f2a966c976e9f478dd69323b (patch) | |
| tree | 6a5c6267076c6acb3bc154cadc903f7442c9db1d /lua.c | |
| parent | 9b47cee8b218e274c89cb3481ca360a785936f48 (diff) | |
| download | lua-c676f13e1a7dd175f2a966c976e9f478dd69323b.tar.gz lua-c676f13e1a7dd175f2a966c976e9f478dd69323b.tar.bz2 lua-c676f13e1a7dd175f2a966c976e9f478dd69323b.zip | |
stand-alone error-message details
Diffstat (limited to 'lua.c')
| -rw-r--r-- | lua.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.166 2007/06/22 15:33:54 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.167 2007/08/07 16:53:40 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 | */ |
| @@ -76,7 +76,7 @@ static int report (lua_State *L, int status) { | |||
| 76 | static int traceback (lua_State *L) { | 76 | static int traceback (lua_State *L) { |
| 77 | const char *msg = lua_tostring(L, 1); | 77 | const char *msg = lua_tostring(L, 1); |
| 78 | if (msg) | 78 | if (msg) |
| 79 | luaL_traceback(L, L, msg, 2); | 79 | luaL_traceback(L, L, msg, 1); |
| 80 | else if (!lua_isnoneornil(L, 1)) { /* is there an error object? */ | 80 | else if (!lua_isnoneornil(L, 1)) { /* is there an error object? */ |
| 81 | if (!luaL_callmeta(L, 1, "__tostring")) /* try its 'tostring' metamethod */ | 81 | if (!luaL_callmeta(L, 1, "__tostring")) /* try its 'tostring' metamethod */ |
| 82 | lua_pushliteral(L, "(no error message)"); | 82 | lua_pushliteral(L, "(no error message)"); |
| @@ -141,7 +141,7 @@ static int dostring (lua_State *L, const char *s, const char *name) { | |||
| 141 | static int dolibrary (lua_State *L, const char *name) { | 141 | static int dolibrary (lua_State *L, const char *name) { |
| 142 | lua_getglobal(L, "require"); | 142 | lua_getglobal(L, "require"); |
| 143 | lua_pushstring(L, name); | 143 | lua_pushstring(L, name); |
| 144 | return report(L, lua_pcall(L, 1, 0, 0)); | 144 | return report(L, docall(L, 1, 1)); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | 147 | ||
