mirror of
https://github.com/lua/lua
synced 2025-03-28 16:43:03 +03:00
details (comments + text of error messages)
This commit is contained in:
parent
1f259be52a
commit
9945253d57
10
loslib.c
10
loslib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: loslib.c,v 1.59 2015/07/06 15:16:51 roberto Exp roberto $
|
||||
** $Id: loslib.c,v 1.60 2015/11/19 19:16:22 roberto Exp roberto $
|
||||
** Standard Operating System library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -210,18 +210,18 @@ static int getboolfield (lua_State *L, const char *key) {
|
||||
|
||||
static int getfield (lua_State *L, const char *key, int d, int delta) {
|
||||
int isnum;
|
||||
int t = lua_getfield(L, -1, key);
|
||||
int t = lua_getfield(L, -1, key); /* get field and its type */
|
||||
lua_Integer res = lua_tointegerx(L, -1, &isnum);
|
||||
if (!isnum) { /* field is not a number? */
|
||||
if (!isnum) { /* field is not an integer? */
|
||||
if (t != LUA_TNIL) /* some other value? */
|
||||
return luaL_error(L, "field '%s' not an integer", key);
|
||||
return luaL_error(L, "field '%s' is not an integer", key);
|
||||
else if (d < 0) /* absent field; no default? */
|
||||
return luaL_error(L, "field '%s' missing in date table", key);
|
||||
res = d;
|
||||
}
|
||||
else {
|
||||
if (!(-L_MAXDATEFIELD <= res && res <= L_MAXDATEFIELD))
|
||||
return luaL_error(L, "field '%s' out-of-bounds", key);
|
||||
return luaL_error(L, "field '%s' is out-of-bound", key);
|
||||
res -= delta;
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user