improve [unstore_unit] error message

This commit is contained in:
gfgtdf 2017-05-25 12:41:03 +02:00 committed by GitHub
parent 91522afcc1
commit ae111a40de

View file

@ -814,7 +814,10 @@ end
wml_actions.unstore_unit = function(cfg)
local variable = cfg.variable or helper.wml_error("[unstore_unit] missing required 'variable' attribute")
local unit_cfg = wesnoth.get_variable(variable)
local unit_cfg = wesnoth.get_variable(variable) or helper.wml_error("[unstore_unit]: variable '" .. variable .. "' doesn't exist")
if type(variable) ~= "table" or variable.type == nil then
helper.wml_error("[unstore_unit]: variable '" .. variable .. "' doesn't contain unit data")
end
local unit = wesnoth.create_unit(unit_cfg)
local advance = cfg.advance ~= false
local animate = cfg.animate ~= false