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; } diff --git a/lstate.c b/lstate.c index 0b38615a..a65c9d85 100644 --- a/lstate.c +++ b/lstate.c @@ -1,5 +1,5 @@ /* -** $Id: lstate.c,v 2.3 2004/02/16 19:09:52 roberto Exp roberto $ +** $Id: lstate.c,v 2.4 2004/03/15 21:04:33 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -82,6 +82,7 @@ static void f_luaopen (lua_State *L, void *ud) { G(L)->firstudata = obj2gco(u); luaC_link(L, obj2gco(u), LUA_TUSERDATA); setbit(u->uv.marked, FIXEDBIT); + setbit(L->marked, FIXEDBIT); stack_init(L, L); /* init stack */ sethvalue(L, gt(L), luaH_new(L, 0, 4)); /* table of globals */ sethvalue(L, registry(L), luaH_new(L, 4, 4)); /* registry */