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

It seemingly does not work with containers that are considered special, like backpack, bank or reagent bank (anymore?)! Calling this method for those containerIDs will result in an "invalid container ID" error.

See also Container functions, Inventory functions.


inventoryID = ContainerIDToInventoryID(container)


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


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


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