Follow-up Comment #18, patch #1432 (project wesnoth):
boucman: no, some questions still appear, from time to time.
silene:
Darkas (one of gsoc candidates) had patched LuaW_pcall a bit, to support
LUA_MULTRET.
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -364,6 +364,8 @@ static bool luaW_pcall(lua_State *L
lua_rawget(L, LUA_REGISTRYINDEX);
lua_insert(L, -2 - nArgs);
+ int error_handler_index = lua_gettop(L) - nArgs - 1;
+
// Call the function.
int res = lua_pcall(L, nArgs, nRets, -2 - nArgs);
if (res)
@@ -382,7 +384,13 @@ static bool luaW_pcall(lua_State *L
}
// Remove the error handler.
- lua_remove(L, -1 - nRets);
+
+ if(nRets == LUA_MULTRET) {
+ lua_remove(L, error_handler_index);
+ } else {
+ lua_remove(L, -1 - nRets);
+ }
+
return true;
}
is it ok to patch it this way, and, is it ok to simplify by removing old '
lua_remove(L, -1 - nRets);' code and always remove the error handler via
"lua_remove(L, error_handler_index);" ?
_______________________________________________________
Reply to this item at:
<http://gna.org/patch/?1432>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs