View Single Post
02/20/15, 11:59 PM   #2
papaoscar90
Join Date: Feb 2015
Posts: 5
I may have just answered my own question, but am still looking to make sure I am along the right lines.

This:
Lua Code:
  1. FooAddon = {}
  2.  
  3. FooAddon.name = "FooAddon"
  4.  
  5. function FooAddon.Activated()
  6.     d("Activated")
  7. end
  8.  
  9. function FooAddon:Initialize()
  10.     d("Initialize")
  11.     EVENT_MANAGER:RegisterForEvent(FooAddon.name, EVENT_PLAYER_ACTIVATED, FooAddon.Activated)
  12. end
  13.  
  14. function FooAddon.OnAddOnLoaded(event, addonName)
  15.     if addonName ~= "FooAddon" then
  16.     return
  17.     else
  18.         FooAddon:Initialize()
  19.     end
  20. end
  21.  
  22.  
  23. EVENT_MANAGER:RegisterForEvent("FooAddon", EVENT_ADD_ON_LOADED, FooAddon.OnAddOnLoaded)

This outputs the "Activated" again but not Initialize. So it is indeed checking the names of the addons and executing the Initialize() function. Am I correct in assuming that the OnAddOnLoaded function just completes itself before the game is actually out of the loading screen? So anything that it tries to do just doesn't work because the game hasn't actually finished loading?
  Reply With Quote