API:ModuleLoad
From RoR Wiki
UI Lua API · Module functions
Version: WAR 1.4.8
Loads the definition of a single UI module from its .mod file.
ModuleLoad(modFilePath, moduleType, allowLooseFiles)
Arguments
- modFilePath
wstring– Path of the.modfile. It must be a wide string (L"...").- moduleType
number– ASystemData.UiModuleTypevalue from 1 to 5 (PREGAME,DEFAULT_INGAME,CUSTOM_INGAME,MYTHIC_APPROVED_ADDON,USER_ADDON).- allowLooseFiles
boolean–false: the file must be inside the game archives.true: the client first looks for the file on disk and then in the archives.
Returns
Nothing.
Details
- The module is only registered with the client. Its files are not run yet. Call ModulesInitializeAllEnabled or ModuleInitialize afterwards.
- The module type is stored with the module and reported as
moduleTypeby ModulesGetData. allowLooseFilesis also passed on to the loader. The stock UI passesIsInternalBuild(), which is alwaysfalse.allowLooseFilesmust be a real boolean, andmodFilePatha wide string, or an Invalid Parameters error is raised.
Errors
These are written to the UI log; the call returns normally.
Error in function call 'ModuleLoad': file %ls does not exist.Error in function call 'ModuleLoad': Module Type %d is invalid.
Example
Loading the pregame modules one by one, from interfacecore/interfacecore.lua:
for _, modFilePath in ipairs( PREGAME_MODS )
do
ModuleLoad( modFilePath, SystemData.UiModuleType.PREGAME, IsInternalBuild() )
end
ModulesInitializeAllEnabled()
