1
0
mirror of https://github.com/lua/lua.git synced 2025-01-14 05:43:00 +08:00

lua_dostring/lua_dofile should return any values returned by the chunk

This commit is contained in:
Roberto Ierusalimschy 2006-04-12 17:31:15 -03:00
parent 8487913697
commit 18330b6091
2 changed files with 28 additions and 3 deletions

23
bugs
View File

@ -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)))
]],
}

View File

@ -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)))