improve [unstore_unit] error message
This commit is contained in:
parent
91522afcc1
commit
ae111a40de
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue