sure okay, that makes sense. I think I was having issues because i'd swapped a few things round to get it working before (note: not the version i'm using now):
Lua Code:
--
--
local fontstring = frame:CreateFontString(nil, "ARTWORK")
local fontstrings = {}
frame:SetScript("OnEvent", function(self, event, ...)
local shown = 0
-- hide any unused ones first
for i = shown + 1, #fontstrings do
fontstrings[i]:Hide()
end
for i = 1, #cfg.spells do
local spell = cfg.spells[i]
local _, _, _, stacks = UnitBuff("player", spell.name)
if stacks and spell.show==true then
shown = shown + 1
local fontstring = frame:CreateFontString(nil, "ARTWORK")
fontstrings[shown] = fontstring -- keep them all in another indexed table
fontstring:SetFont(STANDARD_TEXT_FONT, spell.size, "OUTLINE")
fontstring:SetShadowOffset(0, 0)
fontstring:SetText(string.rep(spell.symbol, stacks > 0 and stacks or 1))
fontstring:SetTextColor(spell.colour[1], spell.colour[2], spell.colour[3])
fontstring:ClearAllPoints()
if shown > 1 then
fontstring:SetPoint("BOTTOMRIGHT", fontstrings[shown - 1], "TOPRIGHT", 0, -5)
else
fontstring:SetPoint("RIGHT", UIParent, "CENTER", 96, 75)
end
fontstring:SetJustifyH("RIGHT")
fontstring:SetSpacing(2)
fontstring:Show()
end
end
end)
--
--
Anyway, i've just tried this new method. Here's the full code:
https://gist.github.com/anonymous/1bcb3a092180fa6cf71b
Getting:
Code:
1x SpellActivationOverlay.lua:43: attempt to index global "fontstrings" (a nil value)
whenever more than one string tries to show.