API:ModuleInitialize
From RoR Wiki
UI Lua API · Module functions
Version: WAR 1.4.8
Initializes one loaded UI module (addon) by name, together with its dependencies.
ModuleInitialize(moduleName)
Arguments
- moduleName
string– The module's name as given in its.modfile. The comparison is case-sensitive.
Returns
Nothing.
Details
- The module must already be known to the client, through ModuleLoad, ModulesLoadFromDirectory or ModulesLoadFromListFile.
- A module that is already initialized, has already failed, or is disabled is left alone.
- The module's dependencies are initialized first. If a required one is missing, disabled, fails, or leads back to a module that is still being set up, the module is not initialized, its load status records the failure (see
loadStatusin ModulesGetData) and an error is logged. - Initializing a module loads its files and then creates the windows and calls the functions listed in its
OnInitializesection. While this happens the module is the client's current module. When it is done,UiMod %s Initialized.is written to the UI log. - This is the single-module form of ModulesInitializeAllEnabled. The stock UI never calls it.
Errors
These are written to the UI log; the call returns normally.
Error in function call 'ModuleInitialize': %s is not a valid UiMod name.Error Loading UiMod %s: Required Dependency %s not found.Error Loading UiMod %s: Required Dependency %s is not Enabled.Error Loading UiMod %s: Required Dependency %s failed to Initialize.Error Loading UiMod %s: Circular Dependency detected with %s. Load Order = %s(see SetCheckForCircularDependencies)
Example
A minimal example built from the signature:
ModuleLoad( L"Interface/AddOns/MyAddon/MyAddon.mod", SystemData.UiModuleType.USER_ADDON, true ) ModuleInitialize( "MyAddon" )
