From 29a13b4128caccca1c7796a1252cb04d4e8a0569 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 23 Mar 2004 13:38:43 -0300 Subject: detail --- lauxlib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lauxlib.c') diff --git a/lauxlib.c b/lauxlib.c index b1d5527b..e80fa157 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.108 2003/11/05 11:59:14 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.109 2004/02/18 13:40:03 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -267,8 +267,7 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname, */ static int checkint (lua_State *L, int topop) { - int n = (int)lua_tointeger(L, -1); - if (n == 0 && !lua_isnumber(L, -1)) n = -1; + int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1; lua_pop(L, topop); return n; } -- cgit v1.2.3-55-g6feb