Module:ModifierTables: Difference between revisions

Changed sorting for modifier tables
(Use printError function)
(Changed sorting for modifier tables)
Line 329: Line 329:


local obstList = p.getObstaclesWithModifier(modifiers, skill, getOpposites)
local obstList = p.getObstaclesWithModifier(modifiers, skill, getOpposites)
table.sort(obstList, function(a, b) return a.category < b.category end)
for i, obst in Shared.skpairs(obstList) do
for i, obst in Shared.skpairs(obstList) do
local row = {}
local row = {}
Line 335: Line 336:
row.expIcon = Icons.getExpansionIcon(obst.id)
row.expIcon = Icons.getExpansionIcon(obst.id)
row.type = '[[Agility#Obstacles|Agility Obstacle '..tostring(tonumber(obst.category)+1)..']]'
row.type = '[[Agility#Obstacles|Agility Obstacle '..tostring(tonumber(obst.category)+1)..']]'
row.typeText = 'Agility Obstacle '..tostring(tonumber(obst.category)+1)
row.typeText = 'Agility Obstacle '..string.format("%02d", (obst.category + 1))
local totalVal = 0
local totalVal = 0
for i, mod in pairs(modifiers) do
for i, mod in pairs(modifiers) do
Line 450: Line 451:
if modifierCount == 1 and a.val ~= b.val then
if modifierCount == 1 and a.val ~= b.val then
return a.val > b.val
return a.val > b.val
elseif a.type ~= b.type then
elseif a.typeText ~= b.typeText then
return a.type < b.type
return a.typeText < b.typeText
else
else
return a.name < b.name
return a.name < b.name