Script ran too long
Hello!
I'm looking for some help regarding a script ran too long error. It's a module based off PortraitTimers (basically show an aura icon if the unit has a whitelisted aura on them). I'm pretty sure it's the function SetPortraitToTexture() that triggers this error, and it's been bugging me for a while. Anyone got any idea to how i can fix this? Here's a link to the code I use: link Appreciate any input. |
Well, assuming that's what's causing the problem, it's likely only doing so because you're calling it potentially hundreds of times per second in combat, in response to UNIT_AURA (multiply that by the number of units you use this element on). You should keep track of whether the timer is already running, and if so, just return out if the buff is still active.
There are also some questionable bits in your code; for example: Code:
local UnitDebuff, index = UnitDebuff, 0 Code:
UnitDebuff = nil I'd rewrite that update function like so: Code:
local UnitDebuff = UnitDebuff |
Quote:
For the other bits it works with UnitBuff aswell, this: Lua Code:
|
Quote:
It will loop through all debuffs then UnitDebuff becomes nil. Then it iterates over all buffs because it no longer uses UnitDebuff since now it is (nil or UnitBuff). Once it finishes with buffs it breaks out of the while loop. And all that explains why UnitDebuff is made local. |
All times are GMT -6. The time now is 03:50 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI