ADDON varaible usage

Erkki Seppä [05-11-19 - 03:45]
ADDON varaible usage
Filename
IncombatWearHelmet.lua
diff --git a/IncombatWearHelmet.lua b/IncombatWearHelmet.lua
index d3ea55b..6ec69a4 100644
--- a/IncombatWearHelmet.lua
+++ b/IncombatWearHelmet.lua
@@ -6,11 +6,11 @@ local IncombatWearHelmet = {
 	License = "CC BY-SA: Creative Commons Attribution-ShareAlike 4.0 International License",
 	www = "https://github.com/Ek1/IncombatWearHelmet"
 }
-
+local ADDON = "IncombatWearHelmet"
 -- Funktion that changes the helmet visibility according to the combat state
-function IWH_combatState(_, Incombat)
+function IWH_combatState (_, Incombat)

-	-- We need the present hat for all 2^2 state evalutions
+	-- Presening hat for all 2^2 state evalutions
 	local activeHat = GetActiveCollectibleByType(COLLECTIBLE_CATEGORY_TYPE_HAT)

 	if Incombat then
@@ -28,22 +28,21 @@ end

 -- Lets fire up the add-on by registering for events
 function IncombatWearHelmet.Initialize()
-	EVENT_MANAGER:RegisterForEvent(IncombatWearHelmet.Title, EVENT_PLAYER_COMBAT_STATE, IWH_combatState)
+	EVENT_MANAGER:RegisterForEvent(ADDON, EVENT_PLAYER_COMBAT_STATE, IWH_combatState)
 	d( IncombatWearHelmet.Title .. ": initalization done")
 end

-
 -- Variable to keep count how many loads have been done before it was this ones turn.
 local loadOrder = 0
 function IncombatWearHelmet.OnAddOnLoaded(event, addonName)
   if addonName == IncombatWearHelmet.Title then
 --	Seems it is our time so lets stop listening load trigger and initialize the add-on
 	d( IncombatWearHelmet.Title .. ": load order " ..  loadOrder .. ", starting initalization")
-	EVENT_MANAGER:UnregisterForEvent(IncombatWearHelmet.Title, EVENT_ADD_ON_LOADED)
+	EVENT_MANAGER:UnregisterForEvent(ADDON, EVENT_ADD_ON_LOADED)
 	IncombatWearHelmet.Initialize()
   end
   loadOrder = loadOrder+1
 end

 -- Registering the addon's initializing event when add-on's are loaded
-EVENT_MANAGER:RegisterForEvent(IncombatWearHelmet.Title, EVENT_ADD_ON_LOADED, IncombatWearHelmet.OnAddOnLoaded)
\ No newline at end of file
+EVENT_MANAGER:RegisterForEvent(ADDON, EVENT_ADD_ON_LOADED, IncombatWearHelmet.OnAddOnLoaded)
\ No newline at end of file