- Ammo : Make a couple routines local rather than global.
urnati [01-30-24 - 14:54]
- Ammo : Make a couple routines local rather than global.
diff --git a/TitanAmmo/TitanClassicAmmo.lua b/TitanAmmo/TitanClassicAmmo.lua
index d3d0a45..5685037 100644
--- a/TitanAmmo/TitanClassicAmmo.lua
+++ b/TitanAmmo/TitanClassicAmmo.lua
@@ -296,7 +296,7 @@ end
-- DESC : Registers the plugin upon it loading
-- **************************************************************************
--]]
-function TitanPanelAmmoButton_OnLoad(self)
+local function OnLoad(self)
self.registry = {
id = TITAN_AMMO_ID,
--builtIn = 1,
@@ -402,7 +402,7 @@ function TitanPanelAmmoButton_GetTooltipText()
return txt
end
-function OnShow()
+local function OnShow()
ClrAmmoInfo()
if IsAmmoClass() then
@@ -418,7 +418,7 @@ function OnShow()
TitanPanelButton_UpdateButton(TITAN_AMMO_ID);
end
-function OnHide()
+local function OnHide()
ClrAmmoInfo()
Events("unregister", "OnHide")
@@ -436,7 +436,7 @@ end
-- DESC : React to any registered Events
-- **************************************************************************
--]]
-function TitanPanelAmmoButton_OnEvent(self, event, arg1, arg2, ...)
+local function OnEvent(self, event, arg1, arg2, ...)
if event == "PLAYER_ENTERING_WORLD" then
if arg1 == true then -- login
EnterWorld()
@@ -467,11 +467,11 @@ local function Create_Frames()
local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelComboTemplate")
window:SetFrameStrata("FULLSCREEN")
-- Using SetScript("OnLoad", does not work
- TitanPanelAmmoButton_OnLoad(window);
+ OnLoad(window);
-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this...
window:SetScript("OnEvent", function(self, event, ...)
- TitanPanelAmmoButton_OnEvent(self, event, ...)
+ OnEvent(self, event, ...)
end)
window:SetScript("OnShow", function(self, button)
OnShow(self)