diff options
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.108 2003/11/05 11:59:14 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.109 2004/02/18 13:40:03 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -267,8 +267,7 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname, | |||
267 | */ | 267 | */ |
268 | 268 | ||
269 | static int checkint (lua_State *L, int topop) { | 269 | static int checkint (lua_State *L, int topop) { |
270 | int n = (int)lua_tointeger(L, -1); | 270 | int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1; |
271 | if (n == 0 && !lua_isnumber(L, -1)) n = -1; | ||
272 | lua_pop(L, topop); | 271 | lua_pop(L, topop); |
273 | return n; | 272 | return n; |
274 | } | 273 | } |