Merge pull request #833 from Blizzard/fix-empty-rules

Fix empty rules.
This commit is contained in:
Tom van Dijck 2017-06-21 09:37:17 -07:00 committed by GitHub
commit f7a5098d59

View File

@ -120,14 +120,22 @@
function rule.getPropertyString(self, prop, value)
-- list?
if type(value) == "table" then
local sep = prop.separator or " "
return table.concat(value, sep)
if #value > 0 then
local sep = prop.separator or " "
return table.concat(value, sep)
else
return nil
end
end
-- enum?
if prop.values then
local i = table.indexof(prop.values, value)
return tostring(i)
if i ~= nil then
return tostring(i)
else
return nil
end
end
-- primitive
@ -159,13 +167,21 @@
-- list?
if type(value) == "table" then
return prop.switch .. table.concat(value, " " .. prop.switch)
if #value > 0 then
return prop.switch .. table.concat(value, " " .. prop.switch)
else
return nil
end
end
-- enum?
if prop.values then
local i = table.indexof(prop.values, value)
return prop.switch .. tostring(i)
if i ~= nil then
return prop.switch .. tostring(i)
else
return nil
end
end
-- primitive