From e51632df272f0aa1988fd8680c89ece10f4c2594 Mon Sep 17 00:00:00 2001 From: Buds Date: Mon, 17 May 2021 15:15:46 +0200 Subject: [PATCH] Change scope of few globals to local --- ItemRack/ItemRack.lua | 10 +++++++--- ItemRack/ItemRackButtons.lua | 2 +- ItemRack/ItemRackEquip.lua | 2 +- ItemRack/ItemRackQueue.lua | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ItemRack/ItemRack.lua b/ItemRack/ItemRack.lua index 5693b77..9ad7acf 100644 --- a/ItemRack/ItemRack.lua +++ b/ItemRack/ItemRack.lua @@ -797,7 +797,7 @@ end function ItemRack.IsSoulbound(bag,slot) ItemRackTooltip:SetBagItem(bag,slot) for i=2,5 do - text = _G["ItemRackTooltipTextLeft"..i]:GetText() + local text = _G["ItemRackTooltipTextLeft"..i]:GetText() if text==ITEM_SOULBOUND or text==ITEM_BIND_QUEST or text==ITEM_CONJURED then return 1 end @@ -1027,7 +1027,7 @@ function ItemRack.BuildMenu(id,menuInclude,masqueGroup) -- display outward from docking point local col,row,xpos,ypos = 0,0,ItemRack.DockInfo[ItemRack.currentDock].xstart,ItemRack.DockInfo[ItemRack.currentDock].ystart local max_cols = 1 - local button + local button, icon if ItemRackUser.SetMenuWrap=="ON" then max_cols = ItemRackUser.SetMenuWrapValue @@ -1707,6 +1707,7 @@ end function ItemRack.DockMenuToCharacterSheet(self) local name = self:GetName() + local slot for i=0,19 do if name=="Character"..ItemRack.SlotInfo[i].name then slot = i @@ -1868,6 +1869,9 @@ end function ItemRack.SetFont(button) local item = _G[button.."Time"] + if not item then + return + end if ItemRackSettings.LargeNumbers=="ON" then item:SetFont("Fonts\\FRIZQT__.TTF",16,"OUTLINE") item:SetTextColor(1,.82,0,1) @@ -2073,7 +2077,7 @@ end -- pushes setname from bags/worn to bank function ItemRack.PutBankedSet(setname) if SpellIsTargeting() or GetCursorInfo() then return end - local bag,slot,freeBag,freeSlot + local inv,bag,slot,freeBag,freeSlot ItemRack.ClearLockList() for _,i in pairs(ItemRackUser.Sets[setname].equip) do if i~=0 then diff --git a/ItemRack/ItemRackButtons.lua b/ItemRack/ItemRackButtons.lua index 604f63b..a9ddec5 100644 --- a/ItemRack/ItemRackButtons.lua +++ b/ItemRack/ItemRackButtons.lua @@ -568,7 +568,7 @@ function ItemRack.WriteButtonCooldowns() end function ItemRack.UpdateButtonLocks() - local isLocked + local isLocked, alreadyLocked for i in pairs(ItemRackUser.Buttons) do if i<20 then isLocked = IsInventoryItemLocked(i) diff --git a/ItemRack/ItemRackEquip.lua b/ItemRack/ItemRackEquip.lua index 14a8257..e9d383b 100644 --- a/ItemRack/ItemRackEquip.lua +++ b/ItemRack/ItemRackEquip.lua @@ -171,7 +171,7 @@ function ItemRack.IterateSwapList(setname) ItemRack.AbortSwap = nil ItemRack.ClearLockList() - local skip = nil + local skip, inv, bag, slot for i=0,19 do -- go in order to handle skips correctly if skip or ItemRack.AbortSwap then skip = nil diff --git a/ItemRack/ItemRackQueue.lua b/ItemRack/ItemRackQueue.lua index f99db9b..cd66e07 100644 --- a/ItemRack/ItemRackQueue.lua +++ b/ItemRack/ItemRackQueue.lua @@ -58,7 +58,7 @@ function ItemRack.ProcessAutoQueue(slot) local list = ItemRack.GetQueues()[slot] - local candidate,bag,s + local candidate,bag for i=1,#(list) do candidate = string.match(list[i],"(%d+)") --FIXME: not sure what list[i] is; it might simply be cleaning up some sort of slot number to make sure it is numeric, OR it might actually be an itemID... if it is the latter then this (conversion to baseID) should be handled by either ItemRack.GetIRString(list[i],true) if list[i] is an ItemRack-style ID or ItemRack.GetIRString(list[i],true,true) if list[i] is a regular ItemLink/ItemString, MOST things point to it being an ItemRack-style ID, but I do not want to mess anything up if this is in fact just a regular number, so I'll leave the line as it is if list[i]==0 then @@ -69,7 +69,7 @@ function ItemRack.ProcessAutoQueue(slot) if not ready or enable==0 or (ItemRackItems[candidate] and ItemRackItems[candidate].priority) then if ItemRack.ItemNearReady(candidate) then if GetItemCount(candidate)>0 and not IsEquippedItem(candidate) then - _,bag,s = ItemRack.FindItem(list[i]) + _,bag = ItemRack.FindItem(list[i]) if bag then if ItemRack.CombatQueue[slot]~=list[i] then ItemRack.EquipItemByID(list[i],slot)