2,875
edits
No edit summary |
No edit summary |
||
Line 254: | Line 254: | ||
local function getCosts(costsTable) | local function getCosts(costsTable) | ||
local res = {} | |||
-- Order table with GP, SC first, then the other items. | -- Order table with GP, SC first, then the other items. | ||
if costsTable['GP'] then table.insert(res, getItemIcon('GP', costsTable['GP'])) costsTable['GP'] = nil end | |||
if costsTable['GP'] then table.insert( | if costsTable['SC'] then table.insert(res, getItemIcon('SC', costsTable['SC'])) costsTable['SC'] = nil end | ||
if costsTable['SC'] then table.insert( | |||
local sortedCosts = Shared.sortDictionary(costsTable, | |||
function(a, b) return a.item < b.amount end, | |||
function(a, b) return {item = a, amount = b} end) | |||
for _, v in pairs(sortedCosts) do | for _, v in pairs(sortedCosts) do | ||
table.insert(res, getItemIcon(v.item, v.amount)) | table.insert(res, getItemIcon(v.item, v.amount)) |
edits