ItemHandle

Group
player
Methods
8
Fields
None

Getting one

bank:item(…)
player:equipment():itemIn(…)
bank:search():first()

Methods

MethodReturnsDescription
id()numberThe item's id.
quantity()numberThe stack size in this slot.
slot()numberWhich slot the item occupies.
name()string?The item's name.
isNoted()booleanWhether this is the noted form. Noted items cannot be eaten, drunk or used, which is why food and dose counts exclude them.
source()ItemSourceWhich container the item came out of.
hasOption(string)booleanWhether interact would find an option: on a carried item its own options and their sub-menus, on a worn item its worn options ("Remove"…
interact(string | { string })booleanInteract with this exact item.

Returned by

MethodReturnsDescription
Bank.itemItemHandle?The first bank slot holding an item.
BoardedBoat.cargo{ ItemHandle }?The cargo hold's items; nil while the game names no hold. The items are read-only.
ContainerQuery.collect{ ItemHandle }Every surviving item, in slot order.
ContainerQuery.firstItemHandle?The first surviving item in slot order.
Equipment.itemInItemHandle?What is worn in one slot.
OwnedBoat.cargo{ ItemHandle }The cargo hold's items, read-only. Its size is stats().cargoSize.

Method details

name

name: (ItemHandle) -> string?

The item's name.

Returns
nil when the id has no definition.

isNoted

isNoted: (ItemHandle) -> boolean

Whether this is the noted form. Noted items cannot be eaten, drunk or used, which is why food and dose counts exclude them.

hasOption

hasOption: (ItemHandle, string) -> boolean

Whether interact would find an option: on a carried item its own options and their sub-menus, on a worn item its worn options ("Remove", "Examine", a jewellery destination). A bank or read-only row answers for the item once carried.

option
The option text, e.g. "Drink".

interact

interact: (ItemHandle, string | { string }) -> boolean

Interact with this exact item.

options
An option ("Eat"), or options to try in order; the first the item exposes wins, counting sub-menu options.
Returns
false when no listed option resolves. Raises on a row another domain handed out (bank:item, bank:search(), bank:cached(), ...): act through that domain, with bank:withdraw or bank:click.