Follow-up Comment #1, bug #21761 (project wesnoth):

>From source inspection, the line that controls the behavior of
synchronize_choice you are talking about is this call to "toconfig" at 2656:

https://github.com/wesnoth/wesnoth/blob/master/src/scripting/lua.cpp#L2655

The toconfig function does as you say, it tries to convert a lua table to a
proper C++ config, and if it fails it reports that it was "misinformed" by
returning false, although currently we are ignoring this return value.

https://github.com/wesnoth/wesnoth/blob/master/src/scripting/lua_api.cpp#L171

I think an appropriate fix might be, in lua.cpp:2655 :


...
                        lua_settop(L, index);
                        if (luaW_pcall(L, 0, 1, false))
                                luaW_toconfig(L, -1, cfg);
                        return cfg;
...
<<change to>>
...
                        lua_settop(L, index);
                        if (luaW_pcall(L, 0, 1, false))
                                if(!luaW_toconfig(L, -1, cfg)) {
                                        chat_message("Lua error", "function 
returned to
wesnoth.synchronize_choice a table that was partially invalid."); 
                                }
                        return cfg;
...

What do you think, does this seem like the right thing to do?

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?21761>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to