View Single Post
06/10/17, 01:29 AM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
I'd say the best way to check for an addon is to look for global variables it sets. Other than that you can either listen to EVENT_ADD_ON_LOADED and check the passed name (might fire too late for some cases though), or you asked the all-mighty ADDON_MANAGER to spill the secret:

Lua Code:
  1. local manager = GetAddOnManager()
  2. local function IsAddonRunning(addonName)
  3.     for i = 1, manager:GetNumAddOns() do
  4.         local name, _, _, _, _, state = manager:GetAddOnInfo(i)
  5.         if name == addonName and state == ADDON_STATE_ENABLED then
  6.             return true
  7.         end
  8.     end
  9.     return false
  10. end
  Reply With Quote