From fa111e33baa1443d7d84b0872234e60f46ab948f Mon Sep 17 00:00:00 2001 From: niemeyer Date: Fri, 19 Mar 2004 21:14:32 +0000 Subject: Upgrading to Lua 5.0.2. CVS patchset: 7179 CVS date: 2004/03/19 21:14:32 --- lua/lib/lbaselib.c | 7 ++++--- lua/lib/liolib.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'lua/lib') 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"); -- cgit v1.2.3