Originally Posted by Dridzt
That's a simple and clever workaround for the bug actually,
might have to poach it for a couple addons that I've had to keep disabled in beta.
Edit: Scratch that, a while loop won't work sadly, nameplate frames are reused for one so you don't always have a nice collection of sequential frames from 1 to n.
Even if we did have that, it would still need to wrap around to index 1 when it exits the while loop.
It's food for thought definitely...
|
Lua Code:
local function Update(self)
-- do whatever
end
local index = 1
local addon = CreateFrame('Frame')
addon:SetScript('OnUpdate', function()
while _G['NamePlate' .. index] do
local frame = _G['NamePlate' .. index]
frame:HookScript('OnShow', Update)
Update(frame)
index = index + 1
end
end)
addon:Show()