API:GetMacrosData
From RoR Wiki
UI Lua API · Game functions
Version: WAR 1.4.8
Returns the player's macros.
macros = GetMacrosData()
Arguments
None.
Returns
- macros
table– Array of 48 macro tables, indexed by macro slot from 1 to 48.
Each macro table has these fields:
| Key | Type | Meaning |
|---|---|---|
name |
wstring |
Macro name. |
text |
wstring |
Macro text (the commands it runs). |
iconNum |
number |
Icon id for GetIconData. |
Details
- The table always has 48 entries, including empty macro slots.
- If the macro system is not loaded yet, or the Lua state is not available, the function returns nothing.
- A new table is built on every call. The stock UI caches it in
DataUtils.GetMacros()(easystem_utils/source/datautils.lua) and rebuilds it only whenGameData.Macros.macrosDirtyis set.
Errors
None.
Example
From easystem_utils/source/datautils.lua:
function DataUtils.GetMacros()
if( GameData.Macros.macrosDirty ) then
GameData.Macros.macrosDirty = false
DataUtilsData.macros = GetMacrosData()
end
return DataUtilsData.macros
end
From ea_macrowindow/source/macrowindow.lua:
local macros = DataUtils.GetMacros() ... local texture, x, y = GetIconData( macros[slot].iconNum )
