Quantcast

Making some functions local

Darthpred [07-11-14 - 20:12]
Making some functions local
Filename
ElvUI_SLE/modules/backgrounds.lua
ElvUI_SLE/modules/baginfo.lua
diff --git a/ElvUI_SLE/modules/backgrounds.lua b/ElvUI_SLE/modules/backgrounds.lua
index 7e069d5..da604a1 100644
--- a/ElvUI_SLE/modules/backgrounds.lua
+++ b/ElvUI_SLE/modules/backgrounds.lua
@@ -4,7 +4,7 @@ local BG = E:GetModule('SLE_BackGrounds');
 local BGb, BGl, BGr, BGa, Fr

 --Frames setup
-function BG:FramesCreate()
+local function CreateFrames()
 	BGb = CreateFrame('Frame', "BottomBG", E.UIParent);
 	BGl = CreateFrame('Frame', "LeftBG", E.UIParent);
 	BGr = CreateFrame('Frame', "RightBG", E.UIParent);
@@ -37,7 +37,7 @@ function BG:FramesCreate()
 end

 --Frames Size
-function BG:FramesSize()
+local function FramesSize()
 	if not BGb then return end
 	local db = E.db.sle.backgrounds
 	for _,v in pairs(Fr) do
@@ -46,7 +46,7 @@ function BG:FramesSize()
 end

 --Frames points
-function BG:FramesPositions()
+local function FramesPositions()
 	if not BGb then return end
 	BGb:Point("BOTTOM", E.UIParent, "BOTTOM", 0, 21);
 	BGl:Point("BOTTOMRIGHT", E.UIParent, "BOTTOM", -(E.screenwidth/4 + 32)/2 - 1, 21);
@@ -55,7 +55,7 @@ function BG:FramesPositions()
 end

 --Updating textures
-function BG:UpdateTex()
+local function UpdateTex()
 	if not BGb then return end
 	local db = E.db.sle.backgrounds
 	for _,v in pairs(Fr) do
@@ -66,7 +66,7 @@ function BG:UpdateTex()
 end

 --Visibility / Enable check
-function BG:FramesVisibility()
+local function FramesVisibility()
 	if not BGb then return end
 	local db = E.db.sle.backgrounds
 	for _,v in pairs(Fr) do
@@ -84,9 +84,9 @@ function BG:UpdateFrames()
 	for _,v in pairs(Fr) do
 				v[1]:SetTemplate(db[v[2]].template, true)
 	end
-	BG:FramesSize()
-	BG:FramesVisibility()
-    BG:UpdateTex()
+	FramesSize()
+	FramesVisibility()
+    UpdateTex()
 end

 function BG:RegisterHide()
@@ -103,8 +103,8 @@ end

 function BG:Initialize()
 	if not E.private.sle.backgrounds then return end
-	BG:FramesCreate()
-	BG:FramesPositions()
+	CreateFrames()
+	FramesPositions()
 	BG:UpdateFrames()
 	BG:RegisterHide()

diff --git a/ElvUI_SLE/modules/baginfo.lua b/ElvUI_SLE/modules/baginfo.lua
index 0ae6589..b03b0f7 100644
--- a/ElvUI_SLE/modules/baginfo.lua
+++ b/ElvUI_SLE/modules/baginfo.lua
@@ -39,7 +39,7 @@ local quickFormat = {
 	[3] = function(font, map) font:SetFormattedText("|cffffffaa%s %s %s|r", Utf8Sub(map[1], 1, 4), Utf8Sub(map[2], 1, 4), Utf8Sub(map[3], 1, 4)) end,
 }

-function BI:BuildEquipmentMap(clear)
+local function BuildEquipmentMap(clear)
 	-- clear mapped names
 	for k, v in pairs(equipmentMap) do
 		twipe(v)
@@ -63,7 +63,7 @@ function BI:BuildEquipmentMap(clear)
 	end
 end

-function BI:UpdateContainerFrame(frame, bag, slot)
+local function UpdateContainerFrame(frame, bag, slot)
 	if (not frame.equipmentinfo) then
 		frame.equipmentinfo = frame:CreateFontString(nil, "OVERLAY")
 		frame.equipmentinfo:FontTemplate(E.media.font, 12, "THINOUTLINE")
@@ -84,23 +84,23 @@ function BI:UpdateContainerFrame(frame, bag, slot)
 	end
 end

-function BI:UpdateBagInformation(clear)
+local function UpdateBagInformation(clear)
 	updateTimer = nil

-	self:BuildEquipmentMap(clear)
+	BuildEquipmentMap(clear)
 	for _, container in pairs(containers) do
 		for _, bagID in ipairs(container.BagIDs) do
 			for slotID = 1, GetContainerNumSlots(bagID) do
-				self:UpdateContainerFrame(container.Bags[bagID][slotID], bagID, slotID)
+				UpdateContainerFrame(container.Bags[bagID][slotID], bagID, slotID)
 			end
 		end
 	end
 end

-function BI:DelayUpdateBagInformation(event)
+local function DelayUpdateBagInformation(event)
 	-- delay to make sure multiple bag events are consolidated to one update.
 	if not updateTimer then
-		updateTimer = BI:ScheduleTimer("UpdateBagInformation", .25)
+		updateTimer = BI:ScheduleTimer(UpdateBagInformation, .25)
 	end
 end

@@ -110,13 +110,13 @@ function BI:ToggleSettings()
 	end

 	if E.private.sle.equip.setoverlay then
-		self:RegisterEvent("EQUIPMENT_SETS_CHANGED", "DelayUpdateBagInformation")
-		self:RegisterEvent("BAG_UPDATE", "DelayUpdateBagInformation")
-		BI:UpdateBagInformation()
+		self:RegisterEvent("EQUIPMENT_SETS_CHANGED", DelayUpdateBagInformation)
+		self:RegisterEvent("BAG_UPDATE", DelayUpdateBagInformation)
+		UpdateBagInformation()
 	else
 		self:UnregisterEvent("EQUIPMENT_SETS_CHANGED")
 		self:UnregisterEvent("BAG_UPDATE")
-		BI:UpdateBagInformation(true)
+		UpdateBagInformation(true)
 	end
 end