From 29a13b4128caccca1c7796a1252cb04d4e8a0569 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 23 Mar 2004 13:38:43 -0300 Subject: [PATCH] detail --- lauxlib.c | 5 ++--- lstate.c | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) 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 */