Violet

Storage

On this page

Use core.storage to inspect an open storage dialog and transfer items or Mesos between the character and storage.

Storage must be open

Read functions return nil when storage is unavailable. Actions return false when storage is closed, busy, or the requested transfer is not currently valid.

A true action result means the transfer was submitted. Wait for is_busy() to return false and read the updated state before sending another action.

Storage Item Structure

get_items() and get_inventory_items() return arrays of storage item records:

PropertyTypeDescription
idnumberItem ID
countnumberAvailable quantity
positionnumberInventory or storage position
indexnumberZero-based index accepted by withdraw() or deposit()
tab_idnumberInventory category
namestring?Display name when available

Pass the returned record directly to transfer functions when possible.

Functions

core.storage.is_open() -> boolean

Returns whether a storage dialog is currently open.


core.storage.is_busy() -> boolean

Returns whether storage is waiting for an earlier action to finish.


core.storage.get_meso() -> number | nil

Returns the Meso balance currently held in storage.


core.storage.get_items() -> table<storage_item> | nil

Returns the items currently held in storage.


core.storage.get_inventory_items() -> table<storage_item> | nil

Returns the character inventory items shown by the storage interface.


core.storage.withdraw(item_or_index: storage_item | number, count?: number) -> boolean

Withdraws an item from storage. Pass a get_items() record or its index; omit count to transfer the full stack.


core.storage.deposit(item_or_index: storage_item | number, count?: number) -> boolean

Deposits an item from the character inventory. Pass a get_inventory_items() record or its index; omit count to transfer the full stack.


core.storage.withdraw_meso(amount: number) -> boolean

Withdraws a positive whole-number Meso amount after validating the available balance and account limits.


core.storage.deposit_meso(amount: number) -> boolean

Deposits a positive whole-number Meso amount after validating the character balance and account limits.


core.storage.withdraw_all_ui() -> boolean

Runs the storage interface's Withdraw All action when available.


core.storage.deposit_all_ui() -> boolean

Runs the storage interface's Deposit All action when available.


core.storage.close() -> boolean

Closes storage when no action is pending.

lua
local stored = core.storage.get_items()
if stored and stored[1] and not core.storage.is_busy() then
    core.storage.withdraw(stored[1])
end