WoW:API LoadAddOn: Difference between revisions
Jump to navigation
Jump to search
LoadAddOn - Documentation by Flickering
mNo edit summary |
m (→Parameters) |
||
Line 14: | Line 14: | ||
:;loaded : Flag - Indicates if the AddOn was loaded, 1 if it is, nil if it is not. | :;loaded : Flag - Indicates if the AddOn was loaded, 1 if it is, nil if it is not. | ||
:;reason : String - The reason why the AddOn cannot be loaded. This is nil if the addon was loaded, otherwise it contains a code indicating the reason. (Observed reason codes: "DISABLED") | :;reason : String - The reason why the AddOn cannot be loaded. This is nil if the addon was loaded, otherwise it contains a code indicating the reason. (Observed reason codes: "DISABLED", "NOT_DEMAND_LOADED", "MISSING", "CORRUPT") | ||
=== Usage === | |||
local loaded,reason = LoadAddOn("MyOtherAddOn") | |||
if (not loaded) then | |||
if (reason == "DISABLED") then | |||
do stuff | |||
elseif (reason == "MISSING") then | |||
do other stuff | |||
elseif (reason == "CORRUPT") then | |||
do something else | |||
end | |||
return | |||
end | |||
== Details == | == Details == |
Revision as of 19:14, 18 November 2005
Request the loading of an On-Demand AddOn.
loaded, reason = LoadAddOn(index or "name")
Parameters
Arguments
- (index or "name")
- index
- Integer - The index of the AddOn in the user's AddOn list. Note that you cannot access Blizzard-provided AddOns through this mechanism.
- name
- String - The name of the AddOn to be queries. You can access Blizzard-provided AddOns through this mechanism.
Returns
- loaded, reason
- loaded
- Flag - Indicates if the AddOn was loaded, 1 if it is, nil if it is not.
- reason
- String - The reason why the AddOn cannot be loaded. This is nil if the addon was loaded, otherwise it contains a code indicating the reason. (Observed reason codes: "DISABLED", "NOT_DEMAND_LOADED", "MISSING", "CORRUPT")
Usage
local loaded,reason = LoadAddOn("MyOtherAddOn") if (not loaded) then if (reason == "DISABLED") then do stuff elseif (reason == "MISSING") then do other stuff elseif (reason == "CORRUPT") then do something else end return end
Details
- Prior to the 1.8 patch, this could be used to load addons which were not on-demand if they were disabled at start up and then enabled during the play session. The 1.8 patch will restrict this to ONLY addons which are truly marked on demand in their .toc files (## LoadOnDemand: 1).