From 895f0ccd4c51cc3da26deb293d04f1c717904364 Mon Sep 17 00:00:00 2001 From: Sandor Takacs Date: Tue, 6 Sep 2016 18:01:28 +0200 Subject: [PATCH] Variables in for statements are always locals --- MyBagsCore/MyBags.lua | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/MyBagsCore/MyBags.lua b/MyBagsCore/MyBags.lua index 8fb20d4..d98e2ab 100644 --- a/MyBagsCore/MyBags.lua +++ b/MyBagsCore/MyBags.lua @@ -706,13 +706,12 @@ end function MyBagsCore:GetSlotCount() local slots, used, displaySlots = 0, 0, 0 - local i - local bagIndex if self.isBank then if self:CanSaveItems() or self.isLive then slots = 28 displaySlots = 28 end + for i = 1, slots do if (self:GetInfo(BANK_CONTAINER, i)) then used = used + 1 @@ -923,7 +922,6 @@ function MyBagsCore:BagButton_OnEnter(widget) if self.GetOpt("HlItems") then -- Highlight - local i for i = 1, self.GetOpt("MAXBAGSLOTS") do local button = _G[bagFrame:GetName() .. "Item" .. i] if button then @@ -938,7 +936,6 @@ end function MyBagsCore:BagButton_OnLeave(widget) SetMoneyFrameColor("GameTooltipMoneyFrame", 1.0, 1.0, 1.0) GameTooltip:Hide() - local i for i = 1, self.GetOpt("MAXBAGSLOTS") do local button = _G[widget:GetParent():GetName() .. "Item" .. i] if button then @@ -1065,8 +1062,7 @@ function MyBagsCore:LayoutOptions() if (BackpackTokenFrame_IsShown()) then token:SetParent(self.frameName) token:SetPoint("RIGHT", cash, "LEFT", -10, 0) - local i - for i=1, MAX_WATCHED_TOKENS do + for i = 1, MAX_WATCHED_TOKENS do local name, count, icon, currencyID = GetBackpackCurrencyInfo(i) -- Update watched tokens local watchButton = _G[self.frameName .. "TokenFrameToken"..i] @@ -1307,7 +1303,6 @@ function MyBagsCore:LayoutBagFrame(bagFrame) searchText = strlower(strtrim(searchText)) end - local slot local itemBase = bagFrameName .. "Item" local bagButton = _G[bagFrameName .. "Bag"] local slotColor = ((self.GetOpt("SlotColor")) or MYBAGS_SLOTCOLOR) @@ -1508,7 +1503,7 @@ function MyBagsCore:LayoutFrame() self.isLive = self:IsLive() local bagBase = self.frameName .. "Bag" - local bagIndex, bagFrame, bag + local bagFrame self.curRow, self.curCol = 0,0 self:LayoutOptions() if self.isEquipment then @@ -1950,7 +1945,6 @@ local mixins = { } function MyBagsCore:Embed( target ) - local k, v for k, v in pairs(mixins) do target[v] = self[v] end