diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-07-02 14:35:06 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-07-02 14:35:06 -0300 |
commit | a9dc7c88283a8046ad40c592f9e626d93e8e14a1 (patch) | |
tree | 693fa40d1ca9beceb5af5d4d4325401abe3f96a2 /loslib.c | |
parent | 7192afafeeb1a96b3de60af90a72cd8762b09d94 (diff) | |
download | lua-a9dc7c88283a8046ad40c592f9e626d93e8e14a1.tar.gz lua-a9dc7c88283a8046ad40c592f9e626d93e8e14a1.tar.bz2 lua-a9dc7c88283a8046ad40c592f9e626d93e8e14a1.zip |
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.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loslib.c,v 1.29 2009/12/17 13:08:51 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.30 2010/07/02 11:38:13 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 | */ |
@@ -146,11 +146,10 @@ static int getboolfield (lua_State *L, const char *key) { | |||
146 | 146 | ||
147 | 147 | ||
148 | static int getfield (lua_State *L, const char *key, int d) { | 148 | static int getfield (lua_State *L, const char *key, int d) { |
149 | int res; | 149 | int res, isnum; |
150 | lua_getfield(L, -1, key); | 150 | lua_getfield(L, -1, key); |
151 | if (lua_isnumber(L, -1)) | 151 | res = (int)lua_tointegerx(L, -1, &isnum); |
152 | res = (int)lua_tointeger(L, -1); | 152 | if (!isnum) { |
153 | else { | ||
154 | if (d < 0) | 153 | if (d < 0) |
155 | return luaL_error(L, "field " LUA_QS " missing in date table", key); | 154 | return luaL_error(L, "field " LUA_QS " missing in date table", key); |
156 | res = d; | 155 | res = d; |