Originally Posted by SDPhantom
You need to set this hook outside or it'll keep hooking itself indefinitely. Eventually, this will cause a stack overflow when the hook is called.
This is the alternative I came up with. It only applies the position hook once.
Lua Code:
-- Doesn't need to be done, but saves some (not all) processing TargetFrame:UnregisterEvent("UNIT_AURA"); FocusFrame:UnregisterEvent("UNIT_AURA"); local function ReleaseAllAuras(self) for obj in self.auraPools:EnumerateActive() do obj:Hide(); end self.auraPools:ReleaseAll()-- Cleanup end hooksecurefunc(TargetFrame,"UpdateAuras",ReleaseAllAuras); hooksecurefunc(FocusFrame,"UpdateAuras",ReleaseAllAuras); local function SpellBar_SetPoint(self) local meta=getmetatable(self).__index;-- Calls through self will trigger our hook, so we're making them through the metatable meta.ClearAllPoints(self); meta.SetPoint(self,"TOPLEFT",meta.GetParent(self),"BOTTOMLEFT",43,-28); end hooksecurefunc(TargetFrame.spellbar,"SetPoint",SpellBar_SetPoint); hooksecurefunc(FocusFrame.spellbar,"SetPoint",SpellBar_SetPoint);
|
Thanks a lot! I'm going to update my file with your code