Lua API: Better error checking when converting a location set to a WML variable
This commit is contained in:
parent
c6f4e8db28
commit
695eb8356d
1 changed files with 5 additions and 1 deletions
|
@ -265,8 +265,12 @@ function methods:to_wml_var(name)
|
|||
local i = 0
|
||||
wml.variables[name] = nil
|
||||
self:stable_iter(function(x, y, v)
|
||||
if type(v) == 'table' then
|
||||
if wml.valid(v) then
|
||||
wml.variables[string.format("%s[%d]", name, i)] = v
|
||||
elseif wml.valid{value = v} then
|
||||
wml.variables[string.format("%s[%d]", name, i)] = {value = v}
|
||||
elseif type(v) ~= 'boolean' then
|
||||
warning('Location set value could not be converted to a WML variable:', v)
|
||||
end
|
||||
wml.variables[string.format("%s[%d].x", name, i)] = x
|
||||
wml.variables[string.format("%s[%d].y", name, i)] = y
|
||||
|
|
Loading…
Add table
Reference in a new issue