Returns the inventoryID corresponding to a given containerID. The results of this function can be used with GetInventorySlotInfo() and other related inventory functions.


See also Container functions, Inventory functions.

Signature:

inventoryID = ContainerIDToInventoryID(container)

Arguments:

  • container - Index of one of the player's bags or other containers (number, containerID)

Returns:

  • inventoryID - Identifier for the container usable with Inventory APIs (number, inventoryID)

Examples:

-- Switches the player's first bag (the one immediately left of the backpack)
-- with the first bank bag (or puts the bag into the bank if the bank bag slot is empty)
local firstBagSlot = ContainerIDToInventoryID(1)
local firstBankBagSlot = ContainerIDToInventoryID(5)
PickupInventoryItem(firstBagSlot)
PickupInventoryItem(firstBankBagSlot)