Content deleted Content added
Use numerical keys |
simplify, make more robust |
||
(2 intermediate revisions 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
if (year <= k) and (k < (end_year or 32767)) then end_year = k end
end
if end_year then return
end
Line 66 ⟶ 67:
end
▲ colors = get_year(color_data[team], year)
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[3] .. '", '.. colors[4] .. '", '.. colors[5] .. '"
end
|