Anonymous

Module:Items/ComparisonTables: Difference between revisions

From Melvor Idle
Added better sorting for rune providing table
(Created p.getRuneProvidingItemTable)
(Added better sorting for rune providing table)
Line 541: Line 541:
table.insert(resultPart, '\r\n|' .. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true}))
table.insert(resultPart, '\r\n|' .. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true}))
local runeLines = {}
local runeLines = {}
local sortVal = ''
for j, runePair in pairs(PR) do
for j, runePair in pairs(PR) do
local runeID = runePair.id
local runeID = runePair.id
local qty = runePair.quantity
local qty = runePair.quantity
local rune = Items.getItemByID(runeID)
local rune = Items.getItemByID(runeID)
sortVal = sortVal..rune.name..qty
table.insert(runeLines, Icons.Icon({rune.name, type='item', qty=qty}))
table.insert(runeLines, Icons.Icon({rune.name, type='item', qty=qty}))
end
end
table.insert(resultPart, '\r\n|'..table.concat(runeLines, '<br/>'))
table.insert(resultPart, '\r\n|data-sort-value="'..sortVal..'"|'..table.concat(runeLines, '<br/>'))
end
end