Fix the MP tests

Using an unprotected call in wesnoth.dofile fixes the issue that existed
in the MP tests. Since wesnoth.dofile is only called from Lua code,
and that Lua code was invoked in a protected environment already, I
don't believe this will cause problems.
This commit is contained in:
Celtic Minstrel 2017-05-07 11:01:32 -04:00
parent e9674ec8a7
commit b5a0ef7e4d
2 changed files with 5 additions and 8 deletions

View file

@ -11,8 +11,6 @@ local function plugin()
local events, context, info
local helper = wesnoth.require "helper"
local function idle_text(text)
counter = counter + 1
if counter >= 100 then

View file

@ -693,13 +693,12 @@ int lua_kernel_base::intf_dofile(lua_State* L)
lua_rotate(L, 1, -1);
if (lua_fileops::load_file(L) != 1) return 0;
//^ should end with the file contents loaded on the stack. actually it will call lua_error otherwise, the return 0 is redundant.
error_handler eh = std::bind(&lua_kernel_base::log_error, this, _1, _2 );
lua_rotate(L, 1, 1);
if(this->protected_call(lua_gettop(L) - 1, LUA_MULTRET, eh)) {
return lua_gettop(L);
}
return 0;
// Using a non-protected call here appears to fix an issue in plugins.
// The protected call isn't technically necessary anyway, because this function is called from Lua code,
// which should already be in a protected environment.
lua_call(L, lua_gettop(L) - 1, LUA_MULTRET);
return lua_gettop(L);
}
/**