Also:
All of those "indicatorframe" and "indicatorN" variables are globals, which is not so great, and "IndicatorFrame" is a pretty bad global object name too... especially since you're using the same globals for every unit's indicator frame.
You're using CreateFrame wrong when you create the indicators -- you're passing nil and "OVERLAY" which would be fine if those were texture or fontstring creations, but not for a frame. You need to pass a frame type (eg. "Frame"), a name (should be nil here), and a parent (should be self here).
You're also passing "party" to UnitBuff, but "party" is not a valid unit token, and you don't want to hardcode a unit here, because it looks like you're intending for these indicators to be added to multiple units' frames.
Lua is case-sensitive, so "indicatorframe" and "indicatorFrame" are not the same thing -- you should be getting a nil value error from your SetScript line, since "indicatorFrame" is not defined as a frame or anything else.
Change your whole indicator section to this:
Code:
if cfg.indicators.enable then
local indicators = CreateFrame("Frame", nil ,self)
indicators:SetAllPoints(true)
indicators:EnableMouse(false)
self.indicators = indicators
-- Build the indicators
for i = 1, #indicatorPositions do
local position = indicatorPositions[i]
local indicator = CreateFrame("Frame", nil, indicators)
indicator:SetPoint(position)
indicator:SetSize(5, 5)
indicator:SetBackdrop(indicatorBackdrop)
indicator.aura = cfg.indicators["aura"..i]
indicators[position] = indicator
end
-- Register the event on the frame itself
self:RegisterEvent("UNIT_AURA", UpdateIndicators)
end
And add this
outside and above your spawn function:
Code:
local indicatorPositions = { "TOPLEFT", "TOPRIGHT", "BOTTOMLEFT", "BOTTOMRIGHT" }
local indicatorBackdrop = { bgFile = "Interface\\Buttons\\WHITE8X8" }
local function UpdateIndicators(self, event, unit)
for i = 1, #indicatorPositions do
local position = indicatorPositions[i]
local indicator = indicators[position]
indicator:SetShown(UnitBuff(unit, indicator.aura))
end
end