Module:Constants: Difference between revisions

getModifiersDifference: Exclude modifiers from output where difference is zero
(getModifiersDifference: Handle nil parameters gracefully)
(getModifiersDifference: Exclude modifiers from output where difference is zero)
Line 1,010: Line 1,010:
-- Skill specific modifier
-- Skill specific modifier
for skillID, subVal in pairs(value) do
for skillID, subVal in pairs(value) do
local modName = nil
if subVal ~= 0 then
if modHasPrefix[modBaseName] then
local modName = nil
modName = (subVal < 0 and 'decreased' or 'increased') .. modBaseName
if modHasPrefix[modBaseName] then
else
modName = (subVal < 0 and 'decreased' or 'increased') .. modBaseName
modName = modBaseName
else
modName = modBaseName
end
if modDiff[modName] == nil then
modDiff[modName] = {}
end
table.insert(modDiff[modName], { ["skillID"] = skillID, ["value"] = math.abs(subVal) })
end
end
if modDiff[modName] == nil then
modDiff[modName] = {}
end
table.insert(modDiff[modName], { ["skillID"] = skillID, ["value"] = math.abs(subVal) })
end
end
else
elseif value ~= 0 then
local modName = nil
local modName = nil
if modHasPrefix[modBaseName] then
if modHasPrefix[modBaseName] then