Quantcast

Remove various global vars be making them local as they should be

urnati [08-28-20 - 21:38]
Remove various global vars be making them local as they should be
Filename
Titan/TitanConfig.lua
Titan/TitanMovable.lua
Titan/TitanPanel.lua
Titan/TitanUtils.lua
TitanBag/TitanBag.lua
TitanGold/TitanGold.lua
diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua
index 9879bf8..6fd02f4 100644
--- a/Titan/TitanConfig.lua
+++ b/Titan/TitanConfig.lua
@@ -1309,7 +1309,7 @@ local function TitanUpdateChars()
 		desc = L["TITAN_PANEL_GLOBAL_USE_DESC"],
 		get = function() return TitanAllGetVar("GlobalProfileUse") end,
 		set = function()
-			TitanUtils_SetGlobalProfile(not TitanAllGetVar("GlobalProfileUse"), toon)
+			TitanUtils_SetGlobalProfile(not TitanAllGetVar("GlobalProfileUse"), nil)
 			TitanUpdateChars() -- rebuild the toons
 			AceConfigRegistry:NotifyChange("Titan Panel Addon Chars")
 		end,
diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua
index a92747d..c1c20bf 100755
--- a/Titan/TitanMovable.lua
+++ b/Titan/TitanMovable.lua
@@ -414,7 +414,7 @@ local function MoveMenuFrame(frame_ptr, start_y, top_bottom, force)
 		elseif ( StatusTrackingBarManager:GetNumberVisibleBars() == 1 ) then
 			yOffset = yOffset + 14;
 		end
-		xOfs = TitanPanelGetVar("MainMenuBarXAdj")
+		local xOfs = TitanPanelGetVar("MainMenuBarXAdj")

 		SetPosition(frame, "BOTTOM", "UIParent", "BOTTOM", xOfs, yOffset)
 		adj = true
@@ -510,6 +510,7 @@ local function Titan_ContainerFrames_Relocate()
 	local off_y = 10000 -- something ridiculously high
 	local bottom_y = 0
 	local right_x = 0
+	local frame = {}

 	for index, frameName in ipairs(ContainerFrame1.bags) do
 		frame = _G[frameName];
diff --git a/Titan/TitanPanel.lua b/Titan/TitanPanel.lua
index 103c3f5..5df466d 100644
--- a/Titan/TitanPanel.lua
+++ b/Titan/TitanPanel.lua
@@ -906,6 +906,7 @@ OUT:  None
 --]]
 function TitanPanel_ClearAllBarTextures()
 	-- Clear textures if they already exist
+	local tex = ""
 	for idx,v in pairs (TitanBarData) do
 		for i = 0, numOfTexturesHider do
 			tex = TITAN_PANEL_BACKGROUND_PREFIX..TitanBarData[idx].name.."_"..i
@@ -1759,7 +1760,7 @@ local function TitanPanel_MainMenu()
 		end
 	L_UIDropDownMenu_AddButton(info);

-	local glob, name, player, server = TitanUtils_GetGlobalProfile()
+	local glob, toon, player, server = TitanUtils_GetGlobalProfile()
 	info = {};
 	info.text = "Use Global Profile"
 	info.value = "Use Global Profile"
diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua
index e04476b..ba95597 100644
--- a/Titan/TitanUtils.lua
+++ b/Titan/TitanUtils.lua
@@ -823,7 +823,7 @@ function TitanPanelRightClickMenu_AddHide(id, level)
 	local info = {};
 	info.notCheckable = true;
 	info.text = L["TITAN_PANEL_MENU_HIDE"];
-	info.value = value;
+	info.value = nil -- value; huh - what should this be?
 	info.func = function()
 		TitanPanelRightClickMenu_Hide(id)
 	end
@@ -1036,6 +1036,7 @@ function TitanUtils_ShiftButtonOnBarLeft(name)
 	local from_idx = TitanUtils_GetCurrentIndex(TitanPanelSettings.Buttons,name)
 	local side = TitanPanel_GetPluginSide(name)
 	local bar = TitanUtils_GetWhichBar(name)
+	local to_idx = nil

 	-- buttons on Left are placed L to R;
 	-- buttons on Right are placed R to L
@@ -1650,7 +1651,7 @@ function TitanPanelDisplayRightClickMenu_Toggle(self, isChildButton)
 	-- Per updated menu lib LibUIDropDownMenu Dec 2018
 	-- This could have been done in some initialize code but here it can react
 	-- better to future Titan frame code changes
-	desired_frame = frame.."RightClickMenu"
+	local desired_frame = frame.."RightClickMenu"
 	if _G[desired_frame] then
 		-- all is good - frame exists
 	else
@@ -1909,6 +1910,7 @@ end

 function TitanDumpPluginList()
 	-- Just dump the current list of plugins
+	local plug_in = {}
 	for idx, value in pairs(TitanPluginsIndex) do
 		plug_in = TitanUtils_GetPlugin(TitanPluginsIndex[idx])
 		if plug_in then
@@ -1962,7 +1964,7 @@ TitanDebug("_GetFrameName "
 end

 function TitanDumpTimers()
-	str = "Titan-timers: "
+	local str = "Titan-timers: "
 		.."'"..(TitanAllGetVar("TimerPEW") or "?").."' "
 		.."'"..(TitanAllGetVar("TimerDualSpec") or "?").."' "
 		.."'"..(TitanAllGetVar("TimerLDB") or "?").."' "
diff --git a/TitanBag/TitanBag.lua b/TitanBag/TitanBag.lua
index d039c4b..9c892ea 100644
--- a/TitanBag/TitanBag.lua
+++ b/TitanBag/TitanBag.lua
@@ -233,7 +233,7 @@ local function TextTest(id)
 	totalBagSlots = 0;
 	usedBagSlots = 0;
 	for bag = 0, 4 do -- assuming 0 (Backpack) will not be a profession bag
-		bagType, color = isProfBag(GetBagName(bag))
+		local bagType, color = isProfBag(GetBagName(bag))

 		if bagType then -- found a profession bag
 			-- when user wants profession bags counted, they are listed separately in the plugin
@@ -304,7 +304,7 @@ local function UpdateButton(id)
 	usedBagSlots = 0;
 	for bag = 0, 4 do

-		bagType, color = TitanBag_IsProfBag(GetBagName(bag))
+		local bagType, color = TitanBag_IsProfBag(GetBagName(bag))

 		if not TitanBag_IsProfBag(GetBagName(bag)) then
 			local size = GetContainerNumSlots(bag);
diff --git a/TitanGold/TitanGold.lua b/TitanGold/TitanGold.lua
index c24869d..4f3ba85 100644
--- a/TitanGold/TitanGold.lua
+++ b/TitanGold/TitanGold.lua
@@ -347,6 +347,7 @@ function TitanPanelGoldButton_GetTooltipText()
 		end
 	end

+	local coin_str = ""
 	-- Display total gold
 	coin_str = NiceCash(TitanPanelGoldButton_TotalGold(), false, false)
 	currentMoneyRichText = currentMoneyRichText.."\n"