How to detect Addons

From ESOUI Wiki

Jump to: navigation, search

This is how to detect other Addons in your own addon.

local function IsAddonRunning(addonName)
    local manager = GetAddOnManager()
    for i = 1, manager:GetNumAddOns() do
        local name, _, _, _, _, state = manager:GetAddOnInfo(i)
        if name == addonName and state == ADDON_STATE_ENABLED then
            return true
        end
    end
    return false
end
 
if IsAddonRunning("PvPJ") then
    -- do something if the addon PvPJ is running
end

Make sure, that you use the Addon in the manifest file.

## OptionalDependsOn: PvPJ
Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox