summaryrefslogtreecommitdiff
path: root/loslib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-07-02 14:35:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-07-02 14:35:06 -0300
commita9dc7c88283a8046ad40c592f9e626d93e8e14a1 (patch)
tree693fa40d1ca9beceb5af5d4d4325401abe3f96a2 /loslib.c
parent7192afafeeb1a96b3de60af90a72cd8762b09d94 (diff)
downloadlua-github-a9dc7c88283a8046ad40c592f9e626d93e8e14a1.tar.gz
functions lua_tonumber/lua_tointeger replaced by lua_tonumberx/lua_tointegerx
that have an extra out parameter with conversion status
Diffstat (limited to 'loslib.c')
-rw-r--r--loslib.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/loslib.c b/loslib.c
index 2c378e9b..6baebd91 100644
--- a/loslib.c
+++ b/loslib.c
@@ -1,5 +1,5 @@
/*
-** $Id: loslib.c,v 1.29 2009/12/17 13:08:51 roberto Exp roberto $
+** $Id: loslib.c,v 1.30 2010/07/02 11:38:13 roberto Exp roberto $
** Standard Operating System library
** See Copyright Notice in lua.h
*/
@@ -146,11 +146,10 @@ static int getboolfield (lua_State *L, const char *key) {
static int getfield (lua_State *L, const char *key, int d) {
- int res;
+ int res, isnum;
lua_getfield(L, -1, key);
- if (lua_isnumber(L, -1))
- res = (int)lua_tointeger(L, -1);
- else {
+ res = (int)lua_tointegerx(L, -1, &isnum);
+ if (!isnum) {
if (d < 0)
return luaL_error(L, "field " LUA_QS " missing in date table", key);
res = d;