commit 18330b6091696f2900d89e8ddef6fb548a3ac84d
parent 84879136970b76e5d1782f3b4664c7c8f9076821
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 12 Apr 2006 17:30:52 -0300
lua_dostring/lua_dofile should return any values returned by the chunk
Diffstat:
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/bugs b/bugs
@@ -923,3 +923,26 @@ patch = [[
]],
}
+
+
+@Bug{
+what = [[lua_dostring/lua_dofile should return any values returned
+by the chunk]],
+
+patch = [[
+* lauxlib.h:
+@@ -108,9 +108,11 @@
+
+ #define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
+
+-#define luaL_dofile(L, fn) (luaL_loadfile(L, fn) || lua_pcall(L, 0, 0, 0))
++#define luaL_dofile(L, fn) \
++ (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
+
+-#define luaL_dostring(L, s) (luaL_loadstring(L, s) || lua_pcall(L, 0, 0, 0))+#define luaL_dostring(L, s) \
++ (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
+
+ #define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
+]],
+
+}
diff --git a/lauxlib.h b/lauxlib.h
@@ -1,5 +1,5 @@
/*
-** $Id: lauxlib.h,v 1.86 2005/10/21 13:47:42 roberto Exp roberto $
+** $Id: lauxlib.h,v 1.87 2005/12/29 15:32:11 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -108,9 +108,11 @@ LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
-#define luaL_dofile(L, fn) (luaL_loadfile(L, fn) || lua_pcall(L, 0, 0, 0))
+#define luaL_dofile(L, fn) \
+ (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
-#define luaL_dostring(L, s) (luaL_loadstring(L, s) || lua_pcall(L, 0, 0, 0))
+#define luaL_dostring(L, s) \
+ (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))