Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetSingleItem

From RoR Wiki

UI Lua API · Item functions
Version: WAR 1.4.8

Returns the data of the item in one slot of one item location.

item = GetSingleItem(location, slot, includeEmpty)

Arguments

location
number – A GameData.ItemLocs value. See the table below.
slot
number – Slot inside that location, starting at 1.
includeEmpty
boolean – true to get a table even when the slot is empty.

Returns

item
table – An item data table, or nothing (see Details).

Details

  • Accepted locations and the highest slot number the client accepts for each:
Location Value Highest slot
GameData.ItemLocs.EQUIPPED 2 27
GameData.ItemLocs.INVENTORY 3 80
GameData.ItemLocs.BANK 4 241
GameData.ItemLocs.QUEST_ITEM 9 65
GameData.ItemLocs.INVENTORY_OVERFLOW 20 –
GameData.ItemLocs.CRAFTING_ITEM 30 80
GameData.ItemLocs.CURRENCY_ITEM 31 132
  • Nothing is returned when the location is not in the table, when slot is 0 or above the limit, or when the slot is empty and includeEmpty is false.
  • With includeEmpty = true an empty slot gives a table with default values (id 0, empty name).
  • For INVENTORY_OVERFLOW the slot argument is ignored: the client picks the slot from the overflow contents itself. GetOverflowData is the function the stock UI uses for the overflow.
  • The limits are the client's upper bounds. They are larger than the number of slots a player normally has, so check the slot count yourself.
  • includeEmpty must be a real boolean. Passing nil or a number raises an Invalid Parameters error.
  • The function needs at least three arguments and only reads the last three.

Errors

None besides the generic Invalid Parameters message when an argument has the wrong type.

Example

Refreshing one bank slot, from default/ea_bankwindow/source/bankwindow.lua:

local itemData  = GetSingleItem( GameData.ItemLocs.BANK, slot, false )

BankWindow.items[slot] = itemData

See also