diff options
author | niemeyer <devnull@localhost> | 2004-03-19 21:14:32 +0000 |
---|---|---|
committer | niemeyer <devnull@localhost> | 2004-03-19 21:14:32 +0000 |
commit | fa111e33baa1443d7d84b0872234e60f46ab948f (patch) | |
tree | f362091fc9585e9700ed80a23424ff4af690890b /lua/lib | |
parent | 635edd95230e17e8ada5793719d7e385e729df30 (diff) | |
download | rpm-fa111e33baa1443d7d84b0872234e60f46ab948f.tar.gz rpm-fa111e33baa1443d7d84b0872234e60f46ab948f.tar.bz2 rpm-fa111e33baa1443d7d84b0872234e60f46ab948f.zip |
Upgrading to Lua 5.0.2.
CVS patchset: 7179
CVS date: 2004/03/19 21:14:32
Diffstat (limited to 'lua/lib')
-rw-r--r-- | lua/lib/lbaselib.c | 7 | ||||
-rw-r--r-- | lua/lib/liolib.c | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lua/lib/lbaselib.c b/lua/lib/lbaselib.c index 72114c083..e7b0fe33b 100644 --- a/lua/lib/lbaselib.c +++ b/lua/lib/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.1 2004/03/16 21:58:30 niemeyer Exp $ +** $Id: lbaselib.c,v 1.2 2004/03/19 21:14:32 niemeyer Exp $ ** Basic library ** See Copyright Notice in lua.h */ @@ -274,10 +274,11 @@ static int luaB_loadfile (lua_State *L) { static int luaB_dofile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); + int n = lua_gettop(L); int status = luaL_loadfile(L, fname); if (status != 0) lua_error(L); lua_call(L, 0, LUA_MULTRET); - return lua_gettop(L) - 1; + return lua_gettop(L) - n; } @@ -324,7 +325,7 @@ static int luaB_xpcall (lua_State *L) { static int luaB_tostring (lua_State *L) { - char buff[64]; + char buff[128]; luaL_checkany(L, 1); if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */ return 1; /* use its value */ diff --git a/lua/lib/liolib.c b/lua/lib/liolib.c index 0ff671c1e..3e3963644 100644 --- a/lua/lib/liolib.c +++ b/lua/lib/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 1.1 2004/03/16 21:58:30 niemeyer Exp $ +** $Id: liolib.c,v 1.2 2004/03/19 21:14:32 niemeyer Exp $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -158,7 +158,7 @@ static int aux_close (lua_State *L) { static int io_close (lua_State *L) { - if (lua_isnone(L, 1)) { + if (lua_isnone(L, 1) && lua_type(L, lua_upvalueindex(1)) == LUA_TTABLE) { lua_pushstring(L, IO_OUTPUT); lua_rawget(L, lua_upvalueindex(1)); } @@ -175,7 +175,7 @@ static int io_gc (lua_State *L) { static int io_tostring (lua_State *L) { - char buff[32]; + char buff[128]; FILE **f = topfile(L, 1); if (*f == NULL) strcpy(buff, "closed"); |