UIParentLoadAddOn()

From Warcraft Wiki
Jump to navigation Jump to search
This function is implemented in FrameXML/UIParent.lua.

Load an addon.

loaded = UIParentLoadAddOn( index or "addonName" );


Parameters

Arguments

(index or "addonName")
index
Integer - The index of the AddOn in the user's AddOn list. Note that you cannot access Blizzard-provided AddOns through this mechanism.
addonName
String - The name of the addon you want to load.

Returns

loaded
Flag - Indicates if the AddOn was loaded, 1 if it is, nil if it is not.
An error message is issued if the addon failed to load.

Example

local loaded = UIParentLoadAddOn( "MyFunkyAddon" );

Result

loaded = 1 or nil

Details

  • If the addon fails to load, it is added to a list of failed addons.
  • As of patch 1.8, you can only use this for addons that are marked on demand in their .toc files (## LoadOnDemand: 1).

Functionally similar to this:

local loaded, reason = LoadAddOn(name);
if ( not loaded ) then
    message(format(ADDON_LOAD_FAILED, name, _G["ADDON_"..reason]));
end