From 66ac153775f347279b508586b93f9f27a2e2c3c4 Mon Sep 17 00:00:00 2001 From: shagu Date: Fri, 1 May 2020 21:27:28 +0200 Subject: [PATCH] unitframes: reduce load for buff indicators skip unnecessary table creation for each buff inside the detected bufflist and just add the icons directly. --- api/unitframes.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/api/unitframes.lua b/api/unitframes.lua index 049d00f2..8522cebd 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -1421,7 +1421,7 @@ function pfUI.uf:RefreshUnit(unit, component) pfUI.uf:SetupBuffFilter() if table.getn(pfUI.uf.buffs) > 0 and unit.config.buff_indicator == "1" then - local active = {} + local pos = 1 for i=1,32 do local texture, count = UnitBuff(unitstr, i) @@ -1434,20 +1434,16 @@ function pfUI.uf:RefreshUnit(unit, component) -- match filter for _, filter in pairs(pfUI.uf.buffs) do if filter == string.lower(texture) then - table.insert(active, { texture, timeleft, count }) + pfUI.uf:AddIcon(unit, pos, texture, timeleft, count) + pos = pos + 1 break end end end end - -- add icons for every found buff - for pos, data in pairs(active) do - pfUI.uf:AddIcon(unit, pos, data[1], data[2], data[3]) - end - -- hide unused icon slots - for pos=table.getn(active)+1, 6 do + for pos=pos, 6 do pfUI.uf:HideIcon(unit, pos) end end