diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-03-23 13:38:43 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-03-23 13:38:43 -0300 |
commit | 29a13b4128caccca1c7796a1252cb04d4e8a0569 (patch) | |
tree | 68aa1de39d47a40858fbad6693b004a6500167a6 | |
parent | ef8c0d7d904a40840d34e758007ae07ca87922d0 (diff) | |
download | lua-29a13b4128caccca1c7796a1252cb04d4e8a0569.tar.gz lua-29a13b4128caccca1c7796a1252cb04d4e8a0569.tar.bz2 lua-29a13b4128caccca1c7796a1252cb04d4e8a0569.zip |
detail
-rw-r--r-- | lauxlib.c | 5 | ||||
-rw-r--r-- | lstate.c | 3 |
2 files changed, 4 insertions, 4 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 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.3 2004/02/16 19:09:52 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.4 2004/03/15 21:04:33 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -82,6 +82,7 @@ static void f_luaopen (lua_State *L, void *ud) { | |||
82 | G(L)->firstudata = obj2gco(u); | 82 | G(L)->firstudata = obj2gco(u); |
83 | luaC_link(L, obj2gco(u), LUA_TUSERDATA); | 83 | luaC_link(L, obj2gco(u), LUA_TUSERDATA); |
84 | setbit(u->uv.marked, FIXEDBIT); | 84 | setbit(u->uv.marked, FIXEDBIT); |
85 | setbit(L->marked, FIXEDBIT); | ||
85 | stack_init(L, L); /* init stack */ | 86 | stack_init(L, L); /* init stack */ |
86 | sethvalue(L, gt(L), luaH_new(L, 0, 4)); /* table of globals */ | 87 | sethvalue(L, gt(L), luaH_new(L, 0, 4)); /* table of globals */ |
87 | sethvalue(L, registry(L), luaH_new(L, 4, 4)); /* registry */ | 88 | sethvalue(L, registry(L), luaH_new(L, 4, 4)); /* registry */ |