mirror of
https://github.com/Bluewhale1337/HealBotBlue.git
synced 2026-07-27 09:44:44 +00:00
perf: replace table.foreach with pairs loops to avoid GC spikes during combat
This commit is contained in:
+4
-4
@@ -22,9 +22,9 @@ function HealBot_ShouldHeal(unit)
|
||||
end
|
||||
|
||||
function HealBot_Action_ShouldHealSome()
|
||||
return table.foreach(HealBot_Action_HealButtons, function (index,button)
|
||||
for index, button in pairs(HealBot_Action_HealButtons) do
|
||||
if (HealBot_ShouldHeal(button.unit)) then return button.unit; end
|
||||
end);
|
||||
end
|
||||
end
|
||||
|
||||
function HealBot_MustHeal(unit)
|
||||
@@ -32,9 +32,9 @@ function HealBot_MustHeal(unit)
|
||||
end
|
||||
|
||||
function HealBot_Action_MustHealSome()
|
||||
return table.foreach(HealBot_Action_HealButtons, function (index,button)
|
||||
for index, button in pairs(HealBot_Action_HealButtons) do
|
||||
if (HealBot_MustHeal(button.unit)) then return button.unit; end
|
||||
end);
|
||||
end
|
||||
end
|
||||
|
||||
function HealBot_GetRezSpellForClass()
|
||||
|
||||
+11
-11
@@ -255,9 +255,9 @@ function HealBot_Action_EnableButton(button)
|
||||
end
|
||||
|
||||
function HealBot_Action_EnableButtons()
|
||||
table.foreach(HealBot_Action_HealButtons, function (index, button)
|
||||
HealBot_Action_EnableButton(button);
|
||||
end);
|
||||
for index, button in pairs(HealBot_Action_HealButtons) do
|
||||
HealBot_Action_EnableButton(button)
|
||||
end
|
||||
end
|
||||
|
||||
function HealBot_Action_RefreshButton(button)
|
||||
@@ -285,13 +285,13 @@ end
|
||||
|
||||
function HealBot_Action_RefreshButtons(unit)
|
||||
if unit and HealBot_Action_UnitButtons[unit] then
|
||||
table.foreach(HealBot_Action_UnitButtons[unit], function (index, button)
|
||||
HealBot_Action_RefreshButton(button);
|
||||
end);
|
||||
for index, button in pairs(HealBot_Action_UnitButtons[unit]) do
|
||||
HealBot_Action_RefreshButton(button)
|
||||
end
|
||||
else
|
||||
table.foreach(HealBot_Action_HealButtons, function (index, button)
|
||||
HealBot_Action_RefreshButton(button);
|
||||
end);
|
||||
for index, button in pairs(HealBot_Action_HealButtons) do
|
||||
HealBot_Action_RefreshButton(button)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -748,7 +748,7 @@ function HealBot_Action_PartyChanged()
|
||||
local i = 0;
|
||||
local z = 1;
|
||||
|
||||
table.foreach(HealBot_Action_HealButtons, function (index, button)
|
||||
for index, button in pairs(HealBot_Action_HealButtons) do
|
||||
i = i + 1;
|
||||
local checked = false;
|
||||
local header;
|
||||
@@ -787,7 +787,7 @@ function HealBot_Action_PartyChanged()
|
||||
bar:SetScale(barScale);
|
||||
bar2:SetHeight(bheight);
|
||||
HealBot_Action_SetTexture(bar2, btexture);
|
||||
end);
|
||||
end
|
||||
|
||||
if MaxOffsetY < OffsetY then MaxOffsetY = OffsetY; end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user