From bf96d82b3584fd7aaad2e597a45ad9fceae4b524 Mon Sep 17 00:00:00 2001 From: shagu Date: Sat, 9 May 2020 00:50:09 +0200 Subject: [PATCH] unitframes: cache strsub raid frame detection call --- api/unitframes.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/api/unitframes.lua b/api/unitframes.lua index 9e02e416..9f894573 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -185,9 +185,18 @@ function pfUI.uf:UpdateVisibility() return end + -- cache result of strsub to avoid repeating calls + if not self.cache_raid then + if strsub(self:GetName(),0,6) == "pfRaid" then + self.cache_raid = tonumber(strsub(self:GetName(),7,8)) + else + self.cache_raid = 0 + end + end + -- show groupframes as raid - if strsub(self:GetName(),0,6) == "pfRaid" then - local id = tonumber(strsub(self:GetName(),7,8)) + if self.cache_raid > 0 then + local id = self.cache_raid -- always show self in raidframes if not UnitInRaid("player") and GetNumPartyMembers() == 0 and C.unitframes.selfinraid == "1" and id == 1 then