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

Content deleted Content added
m s
simplify, make more robust
 
(One intermediate revision by the same user not shown)
Line 22:
 
local function get_year(colors, year)
year = tonumber(year)
if year and (year > 0) and colors and colors[6] and type(colors[6] == 'table') then
local end_year = nil
for k in pairs(colors[6]) do
Line 66 ⟶ 67:
end
colors = get_year(color_data[team], year)
if year and year > 0 then
--code for handling year parameter
colors = get_year(color_data[team], year)
else
colors = color_data[team]
end
if ( colors and type(colors) == 'string' ) then
Line 91 ⟶ 87:
local args = frame.args.team and frame.args or frame:getParent().args
local colors = get_colors((args.team or args[1]), nil, args.year)
return '["' .. args.team .. '"] = {{ "' .. colors[1] .. '", '.. colors[2] ..
'", '.. colors[3] .. '", '.. colors[4] .. '", '.. colors[5] .. '"}}'
end