Anonymous

Module:Items/UseTables: Difference between revisions

From Melvor Idle
_getItemUses: Re-order output such that skill uses appear before other uses
(_getItemUses: Check for Magic spell uses; add a few overrides)
(_getItemUses: Re-order output such that skill uses appear before other uses)
Line 342: Line 342:
local useArray = {}
local useArray = {}
local prefix, delim = asList and '* ' or '', asList and '\r\n' or '<br/>'
local prefix, delim = asList and '* ' or '', asList and '\r\n' or '<br/>'
for skillID, skillName in Shared.spairs(skillUses, function(t, a, b) return t[a] < t[b] end) do
table.insert(useArray, prefix .. Icons.Icon({skillName, type='skill'}))
end
for use, _ in Shared.skpairs(otherUses) do
for use, _ in Shared.skpairs(otherUses) do
table.insert(useArray, prefix .. (otherUseText[use] or use))
table.insert(useArray, prefix .. (otherUseText[use] or use))
end
for skillID, skillName in Shared.spairs(skillUses, function(t, a, b) return t[a] < t[b] end) do
table.insert(useArray, prefix .. Icons.Icon({skillName, type='skill'}))
end
end