API:GetEquipmentData
From RoR Wiki
UI Lua API · Game functions
Version: WAR 1.4.8
Returns the items the player has equipped, one table per equipment slot.
equipment = GetEquipmentData()
Arguments
None.
Returns
- equipment
table– Array of 20 item data tables, indexed by equipment slot from 1 to 20.
Details
- The table always has 20 entries. An empty slot gets a blank item table (
id0, emptyname). - If there is no player object, 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.GetEquipmentData()(easystem_utils/source/datautils.lua) and rebuilds it only whenGameData.Player.equippedItemsDirtyis set.
Errors
None.
Example
From easystem_utils/source/datautils.lua:
function DataUtils.GetEquipmentData ()
if (GameData.Player.equippedItemsDirty)
then
GameData.Player.equippedItemsDirty = false
DataUtilsData.equippedItems = GetEquipmentData()
end
return DataUtilsData.equippedItems
end
Comparing with the currently equipped item, from easystem_tooltips/source/itemtooltips.lua:
local curItem = DataUtils.GetEquipmentData()[playerEquipSlot];
