summaryrefslogtreecommitdiff
path: root/lib/lua/src/LuaLib
diff options
context:
space:
mode:
authorpixel <pixel>2004-12-27 19:52:23 +0000
committerpixel <pixel>2004-12-27 19:52:23 +0000
commitffbd44960ec46c3c0def38821623a62d696c6018 (patch)
tree1b8dca54fd64287cda5095348160011eed41f14a /lib/lua/src/LuaLib
parent73b826216433355c36cac2b679dbbe755df53284 (diff)
Updating lua to 5.0.2
Diffstat (limited to 'lib/lua/src/LuaLib')
-rw-r--r--lib/lua/src/LuaLib/lbaselib.c7
-rw-r--r--lib/lua/src/LuaLib/liolib.c6
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/lua/src/LuaLib/lbaselib.c b/lib/lua/src/LuaLib/lbaselib.c
index 11e5504..ea70d2e 100644
--- a/lib/lua/src/LuaLib/lbaselib.c
+++ b/lib/lua/src/LuaLib/lbaselib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lbaselib.c,v 1.4 2004-11-27 21:46:10 pixel Exp $
+** $Id: lbaselib.c,v 1.5 2004-12-27 19:52:23 pixel 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/lib/lua/src/LuaLib/liolib.c b/lib/lua/src/LuaLib/liolib.c
index 69e0a19..29c4821 100644
--- a/lib/lua/src/LuaLib/liolib.c
+++ b/lib/lua/src/LuaLib/liolib.c
@@ -1,5 +1,5 @@
/*
-** $Id: liolib.c,v 1.4 2004-11-27 21:46:10 pixel Exp $
+** $Id: liolib.c,v 1.5 2004-12-27 19:52:23 pixel 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");