no edit summary
m (Correcting a small bug with the perc >= 1 case) |
No edit summary |
||
| Line 5: | Line 5: | ||
local function ColorGradient(perc, ...) | local function ColorGradient(perc, ...) | ||
if perc >= 1 then | if perc >= 1 then | ||
local r, g, b = select( | local r, g, b = select(select('#', ...) - 2, ...) | ||
return r, g, b | return r, g, b | ||
elseif perc <= 0 then | elseif perc <= 0 then | ||
| Line 14: | Line 12: | ||
return r, g, b | return r, g, b | ||
end | end | ||
local num = select('#', ...) / 3 | |||
local segment, relperc = math.modf(perc*(num-1)) | local segment, relperc = math.modf(perc*(num-1)) | ||