Use next instead of pairs
Adrian L Lange [07-22-14 - 05:47]
Use next instead of pairs
diff --git a/Config.lua b/Config.lua
index b305da9..9f1892d 100644
--- a/Config.lua
+++ b/Config.lua
@@ -15,7 +15,7 @@ Panel:RegisterEvent('PLAYER_LOGIN')
Panel:SetScript('OnEvent', function()
HabeebItDB = HabeebItDB or defaults
- for key, value in pairs(defaults) do
+ for key, value in next, defaults do
if(HabeebItDB[key] == nil) then
HabeebItDB[key] = value
end
@@ -25,7 +25,7 @@ Panel:SetScript('OnEvent', function()
end)
function Panel:okay()
- for key, value in pairs(temporary) do
+ for key, value in next, temporary do
HabeebItDB[key] = value
end
@@ -38,7 +38,7 @@ function Panel:default()
end
function Panel:refresh()
- for key, button in pairs(buttons) do
+ for key, button in next, buttons do
if(button:IsObjectType('Button')) then
UIDropDownMenu_SetSelectedValue(button, HabeebItDB[key])
diff --git a/HabeebIt.lua b/HabeebIt.lua
index 5fdf372..e52c063 100644
--- a/HabeebIt.lua
+++ b/HabeebIt.lua
@@ -280,7 +280,7 @@ function Container:Update()
EncounterJournal:UnregisterEvent('EJ_DIFFICULTY_UPDATE')
end
- for index, button in pairs(itemButtons) do
+ for index, button in next, itemButtons do
button:Hide()
end
diff --git a/encounters/Pandaria.lua b/encounters/Pandaria.lua
index 82993f1..38e3e87 100644
--- a/encounters/Pandaria.lua
+++ b/encounters/Pandaria.lua
@@ -2,7 +2,7 @@
local encounterIDs = select(2, ...)
-- http://www.wowhead.com/spells=0?filter=na=Bonus;cr=84:109:16;crs=1:6:5
-for spellID, encounterID in pairs({
+for spellID, encounterID in next, {
-- World
[132205] = 691, -- Sha of Anger
[132206] = 725, -- Salyis' Warband (Galleon)
@@ -64,11 +64,11 @@ for spellID, encounterID in pairs({
[145918] = 865, -- Siegecrafter Blackfuse
[145921] = 853, -- Paragons of the Klaxxi
[145922] = 869 -- Garrosh Hellscream
-}) do
+} do
encounterIDs[spellID] = encounterID
end
--- I told you I hate this guy, didn't I?
+-- Galakras has two IDs, pick whatever the client uses
local Handler = CreateFrame('Frame')
Handler:RegisterEvent('PLAYER_LOGIN')
Handler:SetScript('OnEvent', function()