Skip to content

sdk.inventory

Live backpack / equipped / depot / stash stacks from TContainerStorage. Gold sums gold coin (3031), platinum (3035), crystal (3043). Depot and stash return "not open" when those windows are closed.

lua
local M = require("sdk.inventory")

count_of

function · count_of(stacks, item_id)

Count item_id in a plain stack list (no live inventory).

find_in

function · find_in(stacks, item_id)

First matching stack in a plain stack list.

gold_of

function · gold_of(stacks)

Gold value of a plain stack list.

Service

function · Service(opts)

Construct an inventory helper bound to optional filters.

GetService

function · GetService(opts)

Process inventory service, created on first use.

Get

function · Get()

Returns Inventory.

Returns

TypeSummary
Inventory

items

method · items(self: Inventory, options?: InventoryQuery): ItemStack[], ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
optionsInventoryQuery

Returns

TypeSummary
ItemStack[], ErrorMessage?

count

method · count(self: Inventory, item_id: ItemId): integer?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
item_idItemId

Returns

TypeSummary
integer?, ErrorMessage?

gold

method · gold(self: Inventory): integer?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Returns

TypeSummary
integer?, ErrorMessage?

find

method · find(self: Inventory, item_id: ItemId): ItemStack?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
item_idItemId

Returns

TypeSummary
ItemStack?, ErrorMessage?

equipped

method · equipped(self: Inventory): table<integer, ItemStack>?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Returns

TypeSummary
table&lt;integer, ItemStack&gt;?, ErrorMessage?

containers

method · containers(self: Inventory): ContainerId[]?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Returns

TypeSummary
ContainerId[]?, ErrorMessage?

openContainers

method · openContainers(self: Inventory): ContainerView[], ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Returns

TypeSummary
ContainerView[], ErrorMessage?

container

method · container(self: Inventory, id: ContainerId): ContainerView?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
idContainerId

Returns

TypeSummary
ContainerView?, ErrorMessage?

isFull

method · isFull(self: Inventory): boolean|nil, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Returns

TypeSummary
boolean|nil, ErrorMessage?

move

method · move(self: Inventory, from: ItemStack|ItemLocation, to: ItemLocation, count?: integer): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack|ItemLocation
toItemLocation
countinteger

Returns

TypeSummary
Result?, ErrorMessage?

drop

method · drop(self: Inventory, from: ItemStack|ItemLocation, count?: integer): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack|ItemLocation
countinteger

Returns

TypeSummary
Result?, ErrorMessage?

pickup

method · pickup(self: Inventory, from: ItemStack|ItemLocation, count?: integer): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack|ItemLocation
countinteger

Returns

TypeSummary
Result?, ErrorMessage?

equip

method · equip(self: Inventory, from: ItemStack): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack

Returns

TypeSummary
Result?, ErrorMessage?

dequip

method · dequip(self: Inventory, slot: integer|ItemStack, to?: ItemLocation): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
slotinteger|ItemStack
toItemLocation

Returns

TypeSummary
Result?, ErrorMessage?

close

method · close(self: Inventory, container: ContainerId): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
containerContainerId

Returns

TypeSummary
Result?, ErrorMessage?

useWith

method · useWith(self: Inventory, from: ItemStack, to: ItemStack): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack
toItemStack

Returns

TypeSummary
Result?, ErrorMessage?

open

method · open(self: Inventory, from: ItemStack): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack

Returns

TypeSummary
Result?, ErrorMessage?

split

method · split(self: Inventory, from: ItemStack, count: integer): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack
countinteger

Returns

TypeSummary
Result?, ErrorMessage?

containerService

method · containerService(self: Inventory, options?: ContainerServiceOptions): ContainerService?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
optionsContainerServiceOptions

Returns

TypeSummary
ContainerService?, ErrorMessage?

Arcane SDK catalog generated from scripts/sdk