Thread Tools Display Modes
09-29-12, 01:05 PM   #1
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Gradient Problem

Hi fellas.

I'm having trouble with oUF.ColorGradient, it was working before 1.6 but somehow it doesn't work right now. I checked the changes in Github and the Gradient function haven't been changed in like years... :/

I use this to color a text displaying the HP percentage of a unit.

This is what I call:

Code:
local r, g, b = oUF.ColorGradient(min / max, unpack(oUF.colors.smooth))
This is my smooth table:

Code:
oUF.colors.smooth = { 1, 0, 0, 1, 1, 0, 1, 1, 1} -- R -> Y -> W
Pretty standard.

This is the error I get:

Message: Interface\AddOns\oUF\colors.lua:65: attempt to perform arithmetic on local 'b2' (a nil value)
Time: 09/29/12 20:04:59
Count: 8
Stack: Interface\AddOns\oUF\colors.lua:65: in function `ColorGradient'
Interface\AddOns\oUF_lumen\oUF_lumen.lua:582: in function <Interface\AddOns\oUF_lumen\oUF_lumen.lua:553>
(tail call): ?
(tail call): ?
Interface\AddOns\oUF\events.lua:69: in function <Interface\AddOns\oUF\events.lua:62>

Locals: a = 0.77720642880199
b = 1
perc = 0.77720642880199
num = 2.6666666666667
segment = 1
relperc = 0.29534404800332
r1 = 1
g1 = 0
b1 = 1
r2 = 1
g2 = 1
b2 = nil
(*temporary) = 1
(*temporary) = 0.29534404800332
(*temporary) = 1
(*temporary) = "attempt to perform arithmetic on local 'b2' (a nil value)"

Thanks for any help, I'm clueless.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
09-29-12, 01:13 PM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
The function was changed in 1.6:

Lua Code:
  1. -- 1.5
  2. ColorGradient(min / max, ...)
  3. -- 1.6
  4. ColorGradient(min, max, ...)

This was done due to floating-point exception being enabled in WoW, which makes divisions by zero errors. Most people didn't care to handle these before, so oUF had a hack to work around it.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
09-29-12, 06:22 PM   #3
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Hmm... I feel dumb now. Didn't check the signature of the method well...

Sorry.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Gradient Problem


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off