Module:Storm categories: Difference between revisions

Content deleted Content added
Create standardized typhoon category module
 
String manipulation
Line 274:
 
function p.color(category)
return defs[string.len(0) ~= 0 and string.lower(category).gsub("[^%w]", "") or defaultCategory].color
end
 
function p.name(category, basin)
return defs[string.lenformat(0) ~= 0 and category or defaultCategory].name
defs[string.len(0) ~= 0 and string.lower(category).gsub("[^%w]", "") or defaultCategory].name,
-- Eventually replace with own module
(basin == "Atl" or basin == "EPac" or basin == "SAtl") and "hurricane" or
(basin == "WPac" and "typhooon" or "tropical cyclone")
)
end
 
function p.sortkey(category)
return defs[string.len(0) ~= 0 and string.lower(category).gsub("[^%w]", "") or defaultCategory].sortkey
end