Content deleted Content added
Fix checks |
Support table name definitions |
||
Line 66:
cat5 = {
color = "ff6060",
name =
Atl = "Category 5 hurricane",
EPac = "Category 5 hurricane",
SAtl = "Category 5 hurricane",
WPac = "Category 5 super typhoon",
},
sortkey = 10010
},
cat4 = {
color = "ff8f20",
name =
Atl = "Category 4 hurricane",
EPac = "Category 4 hurricane",
SAtl = "Category 4 hurricane",
WPac = "Category 4 super typhoon",
default = "Category 4 tropical cyclone"
},
sortkey = 10008
},
cat3 = {
color = "ffc140",
name =
Atl = "Category 3 hurricane",
EPac = "Category 3 hurricane",
SAtl = "Category 3 hurricane",
WPac = "Category 3 super typhoon",
default = "Category 3 tropical cyclone"
},
sortkey = 10006
},
cat2 = {
color = "ffe775",
name =
Atl = "Category 2 hurricane",
EPac = "Category 2 hurricane",
SAtl = "Category 2 hurricane",
WPac = "Category 2 super typhoon",
default = "Category 2 tropical cyclone"
},
sortkey = 10004
},
cat1 = {
color = "ffffcc",
name =
Atl = "Category 1 hurricane",
EPac = "Category 1 hurricane",
SAtl = "Category 1 hurricane",
WPac = "Category 1 super typhoon",
default = "Category 1 tropical cyclone"
},
sortkey = 10002
},
Line 295 ⟶ 325:
function p._name(category, basin)
local name_def = (defs[
▲ string.len(category) ~= 0 and
▲ string.gsub(string.lower(category), "[^%w]", "")
return type(name_def) == "table" and
▲ or defaultCategory
(
▲ ] or defs[defaultCategory]).name,
name_def[basin]
or name_def["default"]
or error("No default name for basin-based category name.")
▲ (basin == "WPac" and "typhooon" or "tropical cyclone")
)
or name_def
end
|