LoadManager.lua
Function Summary
- [TOC] X-AfterLoad(...)
- A TOC metadata field allowing addons to specify code to be executed after conditional loading is successful.
- [TOC] X-LoadBy-Launcher(icon, name)
- A TOC metadata field allowing addons to specify that a DataRegistry object of type "launcher" should be created to trigger their loading.
- [TOC] X-LoadIf(...)
- A TOC metadata field allowing addons to specify conditions for whether they should be loaded.
- [TOC] X-LoadWhen(...)
- A TOC metadata field allowing addons to specify events to trigger their loading.
- [TOC] X-LoadWhen-EVENT(...)
- A TOC metadata field allowing addons to specify conditions for whether they should be loaded when an event listed in X-LoadWhen occurs.
Functions
[TOC] X-AfterLoad(...)
A TOC metadata field allowing addons to specify code to be executed after conditional loading is successful. This code will be executed during the event which triggers loading, and accepts the event and its args as varargs, which can be accessed through (...). This allows you to call your addon's event handler to process the event which triggered loading. If you need more code than you can fit in one TOC field, continue your string in X-AfterLoad2, X-AfterLoad3, etc.
Parameters
...
: Lua code to execute after loading.
Usage
## X-AfterLoad: MyAddon:OnEvent(...)
## X-AfterLoad: MyAddon:ShowFrame()
[TOC] X-LoadBy-Launcher(icon, name)
A TOC metadata field allowing addons to specify that a DataRegistry object of type "launcher" should be created to trigger their loading. The created launcher will load the addon upon receiving any click from the user, and pass that click along to the data object's new OnClick handler, if present.
Parameters
icon
: Path to the icon the launcher should use.name
: Optional name for the launcher. If omitted, the name of the addon is used.
[TOC] X-LoadIf(...)
A TOC metadata field allowing addons to specify conditions for whether they should be loaded. This code will be executed at PLAYER_LOGIN. If your addon needs to load sooner, or its conditional needs to be evaluated later, use X-LoadWhen. If you need more code than you can fit in one TOC field, continue your string in X-LoadIf2, X-LoadIf3, etc.
Parameters
...
: Lua code that returns some value if the addon should be loaded, and returns false or nil otherwise.
Usage
## X-LoadIf: return select(2,UnitClass("player")) == "WARRIOR"
[TOC] X-LoadWhen(...)
A TOC metadata field allowing addons to specify events to trigger their loading. Each event may optionally have a corresponding X-LoadWhen-EVENT field. If you need more events than you can fit in one TOC field, continue your list in X-LoadWhen2, X-LoadWhen3, etc.
Parameters
...
: List of events to trigger conditional loading.
Usage
## X-LoadWhen: GROUP_ROSTER_UPDATE, PLAYER_ENTERING_WORLD
See also
[TOC] X-LoadWhen-EVENT(...)
A TOC metadata field allowing addons to specify conditions for whether they should be loaded when an event listed in X-LoadWhen occurs. If not specified, it is assumed that the addon always wants to load on the event. This code will be executed during the specified event, and accepts the event and its args as varargs, which can be accessed through (...). If you need more code than you can fit in one TOC field, continue your string in X-LoadWhen-EVENT2, X-LoadWhen-EVENT3, etc.
Parameters
...
: Lua code that returns some value if the addon should be loaded, and returns false or nil otherwise.
Usage
## X-LoadWhen-PLAYER_ENTERING_WORLD: return (GetNumGroupMembers() > 0)