View Single Post
02-10-09, 02:47 AM   #688
Bruners
A Flamescale Wyrmkin
 
Bruners's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 125
Originally Posted by Caellian View Post
Still in progress with tags, i've recieved an error.

I'm replacing my updateColor function with this

Hex function
...

Code:
oUF.Tags['[colorinfo]'] = function(u)
	local _, class = UnitClass(unit)

	if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then
		return Hex(colors.tapped)
	elseif(UnitIsDead(unit) or UnitIsGhost(unit) or not UnitIsConnected(unit)) then
		return Hex(colors.disconnected)
	elseif(unit == 'pet' and GetPetHappiness()) then
		return Hex(colors.happiness[GetPetHappiness()])
	elseif(UnitIsPlayer(unit)) then
		return Hex(colors.class[class])
	else
		return Hex(FACTION_BAR_COLORS[UnitReaction(unit, 'player')])
	end
end
the first line to color name by class local _, class = UnitClass(unit) gives me an error:
Code:
Interface\AddOns\oUF_Caellian\oUF_cMain.lua:91: Usage: UnitClass("unit")
It was working just fine with the old way, what's wrong putting it in a tag ?

try with changing your oUF.Tags['[colorinfo]'] = function(u) to function(unit)