Roberto Ierusalimschy 21 rokov pred
rodič
commit
29a13b4128
2 zmenil súbory, kde vykonal 4 pridanie a 4 odobranie
  1. 2 3
      lauxlib.c
  2. 2 1
      lstate.c

+ 2 - 3
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;
 }

+ 2 - 1
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 */