Variables in for statements are always locals

This commit is contained in:
2016-09-06 18:01:28 +02:00
parent 4d657ecee1
commit 895f0ccd4c

View File

@ -706,13 +706,12 @@ end
function MyBagsCore:GetSlotCount() function MyBagsCore:GetSlotCount()
local slots, used, displaySlots = 0, 0, 0 local slots, used, displaySlots = 0, 0, 0
local i
local bagIndex
if self.isBank then if self.isBank then
if self:CanSaveItems() or self.isLive then if self:CanSaveItems() or self.isLive then
slots = 28 slots = 28
displaySlots = 28 displaySlots = 28
end end
for i = 1, slots do for i = 1, slots do
if (self:GetInfo(BANK_CONTAINER, i)) then if (self:GetInfo(BANK_CONTAINER, i)) then
used = used + 1 used = used + 1
@ -923,7 +922,6 @@ function MyBagsCore:BagButton_OnEnter(widget)
if self.GetOpt("HlItems") then if self.GetOpt("HlItems") then
-- Highlight -- Highlight
local i
for i = 1, self.GetOpt("MAXBAGSLOTS") do for i = 1, self.GetOpt("MAXBAGSLOTS") do
local button = _G[bagFrame:GetName() .. "Item" .. i] local button = _G[bagFrame:GetName() .. "Item" .. i]
if button then if button then
@ -938,7 +936,6 @@ end
function MyBagsCore:BagButton_OnLeave(widget) function MyBagsCore:BagButton_OnLeave(widget)
SetMoneyFrameColor("GameTooltipMoneyFrame", 1.0, 1.0, 1.0) SetMoneyFrameColor("GameTooltipMoneyFrame", 1.0, 1.0, 1.0)
GameTooltip:Hide() GameTooltip:Hide()
local i
for i = 1, self.GetOpt("MAXBAGSLOTS") do for i = 1, self.GetOpt("MAXBAGSLOTS") do
local button = _G[widget:GetParent():GetName() .. "Item" .. i] local button = _G[widget:GetParent():GetName() .. "Item" .. i]
if button then if button then
@ -1065,8 +1062,7 @@ function MyBagsCore:LayoutOptions()
if (BackpackTokenFrame_IsShown()) then if (BackpackTokenFrame_IsShown()) then
token:SetParent(self.frameName) token:SetParent(self.frameName)
token:SetPoint("RIGHT", cash, "LEFT", -10, 0) 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) local name, count, icon, currencyID = GetBackpackCurrencyInfo(i)
-- Update watched tokens -- Update watched tokens
local watchButton = _G[self.frameName .. "TokenFrameToken"..i] local watchButton = _G[self.frameName .. "TokenFrameToken"..i]
@ -1307,7 +1303,6 @@ function MyBagsCore:LayoutBagFrame(bagFrame)
searchText = strlower(strtrim(searchText)) searchText = strlower(strtrim(searchText))
end end
local slot
local itemBase = bagFrameName .. "Item" local itemBase = bagFrameName .. "Item"
local bagButton = _G[bagFrameName .. "Bag"] local bagButton = _G[bagFrameName .. "Bag"]
local slotColor = ((self.GetOpt("SlotColor")) or MYBAGS_SLOTCOLOR) local slotColor = ((self.GetOpt("SlotColor")) or MYBAGS_SLOTCOLOR)
@ -1508,7 +1503,7 @@ function MyBagsCore:LayoutFrame()
self.isLive = self:IsLive() self.isLive = self:IsLive()
local bagBase = self.frameName .. "Bag" local bagBase = self.frameName .. "Bag"
local bagIndex, bagFrame, bag local bagFrame
self.curRow, self.curCol = 0,0 self.curRow, self.curCol = 0,0
self:LayoutOptions() self:LayoutOptions()
if self.isEquipment then if self.isEquipment then
@ -1950,7 +1945,6 @@ local mixins = {
} }
function MyBagsCore:Embed( target ) function MyBagsCore:Embed( target )
local k, v
for k, v in pairs(mixins) do for k, v in pairs(mixins) do
target[v] = self[v] target[v] = self[v]
end end