From 2b3a4355b684d947e1155110503be3d86d81f047 Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 9 Aug 2018 17:24:08 +0200 Subject: [PATCH] libdebuff: reduce table creations --- libs/libdebuff.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libs/libdebuff.lua b/libs/libdebuff.lua index c3a066a2..69e3b820 100644 --- a/libs/libdebuff.lua +++ b/libs/libdebuff.lua @@ -93,7 +93,10 @@ function libdebuff:AddPending(unit, unitlevel, effect, duration) local unitlevel = unitlevel or 0 if duration > 0 then - libdebuff.pending = { unit, unitlevel, effect, duration } + libdebuff.pending[1] = unit + libdebuff.pending[2] = unitlevel + libdebuff.pending[3] = effect + libdebuff.pending[4] = duration end end @@ -109,9 +112,16 @@ function libdebuff:PersistPending(effect) end end +function libdebuff:ClearPending() + libdebuff.pending[1] = nil + libdebuff.pending[2] = nil + libdebuff.pending[3] = nil + libdebuff.pending[4] = nil +end + function libdebuff:RemovePending(effect) if libdebuff.pending[3] == effect then - libdebuff.pending = {} + libdebuff:ClearPending() end end @@ -133,7 +143,7 @@ function libdebuff:AddEffect(unit, unitlevel, effect, duration) libdebuff.objects[unit][unitlevel][effect].start = GetTime() libdebuff.objects[unit][unitlevel][effect].duration = duration or libdebuff:GetDuration(effect) - libdebuff.pending = {} + libdebuff:ClearPending() if pfUI.uf.target then pfUI.uf:RefreshUnit(pfUI.uf.target, "aura")