Originally Posted by Phanx
...
There are also some questionable bits in your code; for example:
Code:
local UnitDebuff, index = UnitDebuff, 0
while (true) do
index = index + 1
local name, _, icon, _, _, duration, expirationTime, _, _, _, spellId = (UnitDebuff or UnitBuff)(unit, index)
For one, I'd either upvalue UnitDebuff outside of your event handler, or don't bother upvaluing at all. For two, this code can never fall back to using UnitBuff, so you should probably get rid of that, or fix the rest of the code if it's supposed to use UnitBuff under some circumstances.
Code:
UnitDebuff = nil
index = 0
You don't need to manually un-set your (local) variables in Lua; they're automatically garbage-collected once they go out of scope.
...
|
I was thinking the same thing until I realized it scans debuffs before buffs.
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.