Skip to content

Commit

Permalink
Lua: added wesnoth.get_all_vars() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Elvish-Hunter committed Jun 29, 2014
1 parent 37a8e25 commit b0b40eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog
Expand Up @@ -48,6 +48,7 @@ Version 1.13.0-dev:
* 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).
* Added new function wesnoth.get_all_vars().
* Graphics:
* Smooth unit movement over terrain with elevation (e.g. keeps/bridges)
* Fixed bug #22045: Only blit neutral surfaces.
Expand Down
9 changes: 9 additions & 0 deletions src/scripting/lua.cpp
Expand Up @@ -3656,6 +3656,14 @@ static int impl_theme_items_set(lua_State *L)
return 0;
}

/**
* Gets all the WML variables currently set.
* - Ret 1: WML table
*/
static int intf_get_all_vars(lua_State *L) {
luaW_pushconfig(L, resources::gamedata->get_variables());
return 1;
}

LuaKernel::LuaKernel(const config &cfg)
: mState(luaL_newstate()), level_(cfg)
Expand Down Expand Up @@ -3700,6 +3708,7 @@ LuaKernel::LuaKernel(const config &cfg)
{ "find_vacant_tile", &intf_find_vacant_tile },
{ "fire_event", &intf_fire_event },
{ "float_label", &intf_float_label },
{ "get_all_vars", &intf_get_all_vars },
{ "get_dialog_value", &intf_get_dialog_value },
{ "get_displayed_unit", &intf_get_displayed_unit },
{ "get_era", &intf_get_era },
Expand Down

0 comments on commit b0b40eb

Please sign in to comment.