diff options
Diffstat (limited to '')
| -rw-r--r-- | lbaselib.c | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: $ | 2 | ** $Id: lbaselib.c,v 1.1 2000/09/05 19:33:56 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 | */ |
| @@ -217,6 +217,8 @@ static int luaB_next (lua_State *L) { | |||
| 217 | 217 | ||
| 218 | 218 | ||
| 219 | static int passresults (lua_State *L, int status, int oldtop) { | 219 | static int passresults (lua_State *L, int status, int oldtop) { |
| 220 | static const char *const errornames[] = | ||
| 221 | {"OK", "RUN-TIME ERROR", "FILE ERROR", "SYNTAX ERROR", "MEMORY ERROR"}; | ||
| 220 | if (status == 0) { | 222 | if (status == 0) { |
| 221 | int nresults = lua_gettop(L) - oldtop; | 223 | int nresults = lua_gettop(L) - oldtop; |
| 222 | if (nresults > 0) | 224 | if (nresults > 0) |
| @@ -228,7 +230,7 @@ static int passresults (lua_State *L, int status, int oldtop) { | |||
| 228 | } | 230 | } |
| 229 | else { /* error */ | 231 | else { /* error */ |
| 230 | lua_pushnil(L); | 232 | lua_pushnil(L); |
| 231 | lua_pushnumber(L, status); /* error code */ | 233 | lua_pushstring(L, errornames[status]); /* error code */ |
| 232 | return 2; | 234 | return 2; |
| 233 | } | 235 | } |
| 234 | } | 236 | } |
