WoW API < ContainerIDToInventoryID
inventoryId = ContainerIDToInventoryID(bagID)

Arguments Edit

bagID - number of the bag (1 -- NUM_BAG_SLOTS+NUM_BANKBAGSLOTS) to get the inventoryID for.

Returns Edit

inventoryID - the bag's inventory ID used in functions like PutItemInBag(inventoryId) and GetInventoryItemLink("player",inventoryId)

Example Edit

local invID = ContainerIDToInventoryID(1)  
local bagLink = GetInventoryItemLink("player",invID)
DEFAULT_CHAT_FRAME:AddMessage("Bag slot 1 is inventory slot "..invID..", a "..bagLink)

Result Edit

Bag slot 1 is inventory slot 20, a [Imbued Netherweave Bag]

Notes Edit

Querying for items outside the range 1 -- (NUM_BAG_SLOTS+NUM_BANKBAGSLOTS) throws an error.
The player bags begin at container 1 -- currently inventory slot 20.
The bank bags begin at container 5 (1+NUM_BAG_SLOTS) -- currently inventory slot 68.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.