API:GetHotbarIcon
From RoR Wiki
UI Lua API · Hotbar functions
Version: WAR 1.4.8
Returns the icon of the action in a hotbar slot.
iconNum = GetHotbarIcon(slot)
Arguments
- slot
number– Hotbar slot, 1 to 132 (GameData.HOTBAR_TOTAL_SLOT_COUNT).
Returns
- iconNum
number– Icon id for GetIconData, or 0.
Details
- The icon is looked up according to the action type: abilities (types 1 and 10) use the ability's icon, items (type 2) the item's icon, macros (type 4) the macro's icon, and types 7 and 9 their own data. Other types, empty slots and slots outside 1 to 132 give 0.
- A comment in
ea_actionbars/source/actionbutton.luanotes that the icon can be 0 while item data is not yet on the client; the stock button then uses a cached icon. - If there is no player object, or the Lua state is not available, the function returns nothing.
Errors
None besides the generic Invalid Parameters message when the argument is missing or not a number.
Example
From ea_actionbars/source/actionbutton.lua:
local icon = GetHotbarIcon (slot)
if (icon > 0)
then
CacheData (actionType, actionId, "icon", icon)
elseif (icon == 0)
then
icon = GetCachedData (actionType, actionId, "icon") or 0
end
