Fix an issue with ColorGradient barfing on values not between 0 and 1
James Whitehead II [07-31-08 - 10:30]
Fix an issue with ColorGradient barfing on values not between 0 and 1
diff --git a/PerfectRaid.toc b/PerfectRaid.toc
index a0e3612..ac90b9f 100644
--- a/PerfectRaid.toc
+++ b/PerfectRaid.toc
@@ -1,4 +1,4 @@
-## Interface: 20300
+## Interface: 20400
## Title: PerfectRaid
## Version: wowi:revision
## Author: Cladhaire
diff --git a/PerfectRaid_Utils.lua b/PerfectRaid_Utils.lua
index 3c02f5e..a58753d 100644
--- a/PerfectRaid_Utils.lua
+++ b/PerfectRaid_Utils.lua
@@ -27,11 +27,16 @@ function DongleUtils.ColorGradient(perc, ...)
local num = select("#", ...)
local hexes = type(select(1, ...)) == "string"
- if perc == 1 then
+ if perc >= 1 then
if hexes then return select(num, ...)
else return select(num-2, ...), select(num-1, ...), select(num, ...) end
end
+ if perc <= 0 then
+ if hexes then return select(1, ...)
+ else return select(1, ...), select(2, ...), (select(3, ...)) end
+ end
+
if not hexes then num = num / 3 end
local segment, relperc = math.modf(perc*(num-1))