Quantcast WoWInterface - View Single Post - Getting error spammed from a small addon. Can anyone help?
View Single Post
09-20-15, 10:50 PM   #1
Lesteryoung
A Cliff Giant
Join Date: Aug 2015
Posts: 76
Getting error spammed from a small addon. Can anyone help?

Aforementioned error:

1x Tweaks\UnitColor.lua:10: attempt to index global 'c' (a nil value)
Tweaks\UnitColor.lua:10: in function <Tweaks\UnitColor.lua:7>
[C]: in function `TargetUnit'
FrameXML\SecureTemplates.lua:513: in function `handler'
FrameXML\SecureTemplates.lua:649: in function `SecureActionButton_OnClick'
FrameXML\SecureTemplates.lua:689: in function <FrameXML\SecureTemplates.lua:681>

Locals:
(*temporary) = "raid29"
(*temporary) = "PLAYER_TARGET_CHANGED"
(*temporary) = "PLAYER_TARGET_CHANGED"
(*temporary) = <function> defined =[C]:-1

This is the addon:

Code:
local frame = CreateFrame("FRAME")
frame:RegisterEvent("GROUP_ROSTER_UPDATE")
frame:RegisterEvent("PLAYER_TARGET_CHANGED")
frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
frame:RegisterEvent("UNIT_FACTION")

local function eventHandler(self, event, ...)
        if UnitIsPlayer("target") then
                c = RAID_CLASS_COLORS[select(2, UnitClass("target"))]
                TargetFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
        end
        if UnitIsPlayer("focus") then
                c = RAID_CLASS_COLORS[select(2, UnitClass("focus"))]
                FocusFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
        end
end

frame:SetScript("OnEvent", eventHandler)

for _, BarTextures in pairs({TargetFrameNameBackground, FocusFrameNameBackground}) do
        BarTextures:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
end
  Reply With Quote