API:GameData.InteractData.GetLootList
From RoR Wiki
UI Lua API · Loot functions
Version: WAR 1.4.8
Returns the items in the loot window: the loot of the corpse or object the player is looting.
items = GameData.InteractData.GetLootList()
Arguments
None.
Returns
- items
table– Array of item data tables, indexed from 1. Empty if there is no loot.
Details
- Each call builds a new table from the client's stored loot list.
- The index of an item in this table is the
lootIndexused by LootItem and AssignLootItem. - If the Lua state is not available, the function returns nothing.
Errors
None.
Example
From default/ea_lootwindow/source/lootwindow.lua:
EA_Window_Loot.lootData = GameData.InteractData.GetLootList()
EA_Window_Loot.lootDataDisplayOrder = {}
for lootIndex, _ in ipairs( EA_Window_Loot.lootData )
do
table.insert( EA_Window_Loot.lootDataDisplayOrder, lootIndex )
end
ListBoxSetDisplayOrder("EA_Window_LootList", EA_Window_Loot.lootDataDisplayOrder )
-- Show the Window when it contains items
WindowSetShowing( "EA_Window_Loot", EA_Window_Loot.lootDataDisplayOrder[1] ~= nil )
