mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 13:15:41 +00:00
Adding an event handler via the positional call style now defaults to a repeating event
This is a somewhat controversial change! PROS: - This makes wesnoth.game_events.add a drop-in replacement for the on_event function - If you're registering events in preload, most of them WILL be repeating events CONS: - This makes the default depend on the call style; in positional style, it defaults to repeating, and in named-argument style, it defaults to non-repeating - This makes the default different from the WML default of non-repeating events
This commit is contained in:
parent
3435c56f69
commit
d03116f829
@ -3746,7 +3746,7 @@ int game_lua_kernel::intf_add_event(lua_State *L)
|
||||
man.add_event_handler_from_wml(cfg.get_parsed_config(), *this);
|
||||
}
|
||||
} else if(lua_isstring(L, 1)) {
|
||||
bool is_menu_item = luaW_toboolean(L, 3), repeat = false;
|
||||
bool is_menu_item = luaW_toboolean(L, 3), repeat = true;
|
||||
std::string name = read_event_name(L, 1), id;
|
||||
if(is_menu_item) {
|
||||
id = name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user