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 result from a direct transfer means it was submitted. Bulk actions may first request confirmation. Wait for is_busy() to return false and read the updated state before sending another action.

Malformed item, index, count, or amount arguments raise a Lua error. Use records returned by this module whenever possible.

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() -> boolean

Performs the storage window's Withdraw All action, so the storage window must be open. Takes no parameters. Returns false when storage is closed or an earlier request is still pending. The game may then ask the player to confirm, so a true result means the action started, not that items moved.


core.storage.deposit_all() -> boolean

Performs the storage window's Deposit All action, so the storage window must be open. Takes no parameters. Returns false when storage is closed or an earlier request is still pending. The game may then ask the player to confirm, so a true result means the action started, not that items moved.


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