Skip to content

Commit

Permalink
fix bug #21671
Browse files Browse the repository at this point in the history
wesnoth.synchronize_choice checks the return value of toconfig fcn,
and if it indicated that it partially failed to convert the table,
it will chat a warning, IF wesnoth is running in debug mode
(that is game_config::debug = true, which is determined by e.g.
the command line flag --debug)
  • Loading branch information
cbeck88 committed Mar 6, 2014
1 parent 9968636 commit 1e3aec7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog
Expand Up @@ -9,6 +9,10 @@ Version 1.11.11+dev:
* Fixed missing objective in 'The Court of Karrag'.
* Language and i18n:
* Updated translations: German, Slovak
* Lua API:
* Fix bug #21761: wesnoth.synchronize_choice will now give a warning when
the table returned by the user-specified function is not completely valid,
when wesnoth is running in debug mode (--debug command line flag).
* Units:
* Increased the experience requirement for the Rami from 32 to 39
* Increased the experience requirement for the Saree from 56 to 64
Expand Down
7 changes: 5 additions & 2 deletions src/scripting/lua.cpp
Expand Up @@ -2652,8 +2652,11 @@ namespace {
index = 2;
}
lua_settop(L, index);
if (luaW_pcall(L, 0, 1, false))
luaW_toconfig(L, -1, cfg);
if (luaW_pcall(L, 0, 1, false)) {
if(!luaW_toconfig(L, -1, cfg) && game_config::debug) {
chat_message("Lua warning", "function returned to wesnoth.synchronize_choice a table which was partially invalid");
}
}
return cfg;
}

Expand Down

0 comments on commit 1e3aec7

Please sign in to comment.