View Single Post
08/31/23, 08:17 AM   #7
Anna Lee
Join Date: Aug 2023
Posts: 4
Thanks everyone for replying and helping out. The TopLevelControl was the missing part for it to function.

I do have one more question about the unregister event part once the addon was loaded.

I thought I had to write it like this:
Lua Code:
  1. function addon.OnAddOnLoaded(event, loadedAddonName)
  2.     if loadedAddonName == addonName then
  3.         addon.InitializeUI()
  4.     end
  5.     EVENT_MANAGER:UnregisterForEvent(addonName, EVENT_ADD_ON_LOADED)
  6. end
but it’s no longer working if I leave it like this.


If I put it before the end, it’s working again but not sure if the line even has a functionality on this position.
Lua Code:
  1. function addon.OnAddOnLoaded(event, loadedAddonName)
  2.     if loadedAddonName == addonName then
  3.         addon.InitializeUI()
  4.         EVENT_MANAGER:UnregisterForEvent(addonName, EVENT_ADD_ON_LOADED)
  5.     end
  6. end
  Reply With Quote