Module:RaritySort
Documentation for this module may be created at Module:RaritySort/doc
local p = {}
function p.getSortValue(rarity)
-- Return 99 if rarity is nil or not a string
if rarity == nil or type(rarity) ~= "string" then
return 99
end
local r = mw.ustring.lower(rarity)
if r == "always" then
return 1
elseif r:match("^1/%d+") then
return 2
elseif r == "rare" then
return 3
elseif r == "never" then
return 4
else
return 99
end
end
return p