Renamed [foreach] variable= to array= and item_var= to variable=

This commit is contained in:
fendrin 2016-08-06 05:47:16 +02:00
parent 8544320b58
commit b9d2ec4409
2 changed files with 4 additions and 2 deletions

View file

@ -25,6 +25,8 @@ Version 1.13.5+dev:
* New [remove_object] tag which removes applied [object]s from matched units;
it can filter on the entire [object] WML. The most efficient use is to
remove all objects with a specific duration value.
* Renamed [foreach] variable= to array=
* Renamed [foreach] item_var= to variable=
* Lua API:
* Added new functions wesnoth.fire_event_by_id and fire_event_by_name. The old
function wesnoth.fire_event is now an alias for wesnoth.fire_event_by_name

View file

@ -174,10 +174,10 @@ function wml_actions.foreach(cfg)
helper.wml_error "[foreach] does not contain any [do] tags"
end
local array_name = cfg.variable or helper.wml_error "[foreach] missing required variable= attribute"
local array_name = cfg.array or helper.wml_error "[foreach] missing required array= attribute"
local array = helper.get_variable_array(array_name)
if #array == 0 then return end -- empty and scalars unwanted
local item_name = cfg.item_var or "this_item"
local item_name = cfg.variable or "this_item"
local this_item = utils.start_var_scope(item_name) -- if this_item is already set
local i_name = cfg.index_var or "i"
local i = utils.start_var_scope(i_name) -- if i is already set