Module:Sandbox/Ahecht/Gridiron color: Difference between revisions

Content deleted Content added
 
Use numerical keys
Line 23:
local function get_year(colors, year)
if colors and colors[6] and type(colors[6] == 'table') then
local end_year = nil
for team, year_colorsk in pairs(colors[6]) do
if mw.ustring.find(team, "%d%d%d%dthru%d%d%d%d$") then
if (year <= k) and (k < (end_year or 32767)) then end_year = k end
local start_year, end_year = mw.ustring.match(team, "(%d%d%d%d)thru(%d%d%d%d)$")
if (tonumber(start_year) <= tonumber(year)) and (tonumber(year) <= tonumber(end_year)) then
return year_colors
end
end
end
if end_year then return color[6][end_year] end
end