Module:RarityHandler: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
-- | -- Clean: trim and strip leading ~ | ||
local function clean(rarity) | local function clean(rarity) | ||
if not rarity or type(rarity) ~= "string" then return nil end | if not rarity or type(rarity) ~= "string" then return nil end | ||
Line 11: | Line 11: | ||
end | end | ||
function p.getSortValue(frame) | function p.getSortValue(frame) | ||
local rarity = clean(frame.args[1]) | local rarity = clean(frame.args[1]) | ||
Line 31: | Line 30: | ||
end | end | ||
-- | -- For class logic: cleaned string, lowercase | ||
function p.getCleanValue(frame) | |||
local rarity = clean(frame.args[1]) | |||
return rarity or "Unknown" | |||
end | |||
-- For display | |||
function p.normalizeDisplay(frame) | function p.normalizeDisplay(frame) | ||
local original = frame.args[1] | local original = frame.args[1] |