From 190e7a016a9b416e1832f7e292e817c3d2891cce Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Sun, 21 Feb 2021 12:26:11 -0500 Subject: [PATCH] Prevent slot list creation every function run (fixes #5) --- MyAddon.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/MyAddon.lua b/MyAddon.lua index 6686649..083b457 100755 --- a/MyAddon.lua +++ b/MyAddon.lua @@ -34,6 +34,10 @@ MyAddon.taunts = { [1161] = true, -- Challenging Shout [204079] = true -- Final Stand } +MyAddon.slots = { + "HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot", + "WaistSlot", "LegsSlot", "FeetSlot", "MainHandSlot", "SecondaryHandSlot" +} function MyAddon.OnEvent(self, event, ...) events[event](self, ...) @@ -137,13 +141,8 @@ function MyAddon.activateGoliath() end function MyAddon.needsRepair() - local slots = { - "HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot", - "WaistSlot", "LegsSlot", "FeetSlot", "MainHandSlot", "SecondaryHandSlot" - } - - for slot = 1, #slots do - local id = GetInventorySlotInfo(slots[slot]) + for slot = 1, #MyAddon.slots do + local id = GetInventorySlotInfo(MyAddon.slots[slot]) local cur, max = GetInventoryItemDurability(id) if max and cur ~= max then return true end -- 2.45.2