API:ModulesGetData
From RoR Wiki
UI Lua API · Module functions
Version: WAR 1.4.8
Returns information about every UI module (addon) the client has loaded.
modules = ModulesGetData()
Arguments
None.
Returns
- modules
table– An array with one table per loaded module, in the client's module order. Empty if no module has been loaded.
Each module table has these fields, filled by the client:
| Key | Type | Meaning |
|---|---|---|
wideStrName |
wstring |
The module's name, for display. |
moduleType |
number |
The SystemData.UiModuleType the module was loaded with (1–5).
|
loadStatus |
number |
A SystemData.UiModuleLoadStatus value: not loaded, replaced, loading dependencies, one of the failure states, or succeeded with or without errors.
|
isEnabled |
boolean |
The enabled flag (see ModuleSetEnabled). |
isForCurrentGameVersion |
boolean |
Whether the game version in the module's .mod file matches the client's.
|
isAutoDisabledOnGameVersionMismatch |
boolean |
Whether the module is turned off automatically when the versions do not match. |
replacedByModuleName |
string |
Name of the module that replaced this one, when loadStatus is REPLACED.
|
categories |
table |
Array of category numbers from the .mod file.
|
careers |
table |
Array of career-line numbers from the .mod file.
|
The table also contains the data from the module's .mod file. The keys the client writes are name, version, date, autoenabled, f2pusable, replaces, author, description, warinfo, dependencies, files, oninitialize, onupdate, onshutdown, onmessage, versionsettings and savedvariables. The stock UI reads these of them:
| Key | Type | Meaning |
|---|---|---|
name |
string |
The module's name. This is the name ModuleSetEnabled and ModuleInitialize expect. |
version |
string |
The module's version. |
author.name |
string |
The author's name (author is a table).
|
description.text |
string |
The description (description is a table).
|
versionsettings.gameVersion |
string |
The game version the module was made for. |
dependencies |
table |
Array of dependency tables; dependencies[i].name is the name of the required module.
|
Details
- The data is a snapshot. Changing a field in the returned table (the stock UI does this with
isEnabled) does not change the module; use ModuleSetEnabled. - Text from the
.modfile is returned as ordinary strings; the stock UI converts it withStringToWStringbefore display.
Errors
None.
Example
From ea_uimodwindow/source/uimodwindow.lua:
UiModWindow.modsListData = ModulesGetData()
for modIndex, modData in ipairs( UiModWindow.modsListData )
do
modData.modIndex = modIndex
for _, category in ipairs( modData.categories )
do
...
end
end
Reading the details of one module, also from ea_uimodwindow/source/uimodwindow.lua:
LabelSetText( windowName.."ScrollChildName", modData.wideStrName ) ... local version = StringToWString( modData.version )
