diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2016-01-06 11:43:05 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2016-01-06 11:43:05 -0200 |
| commit | 9945253d57a5d328308c543a3c08334512aaf364 (patch) | |
| tree | 20f8ec4d1c7bdb30a71d1c783a067a5ae8eb122a | |
| parent | 1f259be52a6ac8f7cfdee3787ffbf7dd0966748e (diff) | |
| download | lua-9945253d57a5d328308c543a3c08334512aaf364.tar.gz lua-9945253d57a5d328308c543a3c08334512aaf364.tar.bz2 lua-9945253d57a5d328308c543a3c08334512aaf364.zip | |
details (comments + text of error messages)
| -rw-r--r-- | loslib.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loslib.c,v 1.59 2015/07/06 15:16:51 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.60 2015/11/19 19:16:22 roberto Exp roberto $ |
| 3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -210,18 +210,18 @@ static int getboolfield (lua_State *L, const char *key) { | |||
| 210 | 210 | ||
| 211 | static int getfield (lua_State *L, const char *key, int d, int delta) { | 211 | static int getfield (lua_State *L, const char *key, int d, int delta) { |
| 212 | int isnum; | 212 | int isnum; |
| 213 | int t = lua_getfield(L, -1, key); | 213 | int t = lua_getfield(L, -1, key); /* get field and its type */ |
| 214 | lua_Integer res = lua_tointegerx(L, -1, &isnum); | 214 | lua_Integer res = lua_tointegerx(L, -1, &isnum); |
| 215 | if (!isnum) { /* field is not a number? */ | 215 | if (!isnum) { /* field is not an integer? */ |
| 216 | if (t != LUA_TNIL) /* some other value? */ | 216 | if (t != LUA_TNIL) /* some other value? */ |
| 217 | return luaL_error(L, "field '%s' not an integer", key); | 217 | return luaL_error(L, "field '%s' is not an integer", key); |
| 218 | else if (d < 0) /* absent field; no default? */ | 218 | else if (d < 0) /* absent field; no default? */ |
| 219 | return luaL_error(L, "field '%s' missing in date table", key); | 219 | return luaL_error(L, "field '%s' missing in date table", key); |
| 220 | res = d; | 220 | res = d; |
| 221 | } | 221 | } |
| 222 | else { | 222 | else { |
| 223 | if (!(-L_MAXDATEFIELD <= res && res <= L_MAXDATEFIELD)) | 223 | if (!(-L_MAXDATEFIELD <= res && res <= L_MAXDATEFIELD)) |
| 224 | return luaL_error(L, "field '%s' out-of-bounds", key); | 224 | return luaL_error(L, "field '%s' is out-of-bound", key); |
| 225 | res -= delta; | 225 | res -= delta; |
| 226 | } | 226 | } |
| 227 | lua_pop(L, 1); | 227 | lua_pop(L, 1); |
