- This function is implemented by FrameXML in
container = IsBagOpen(BagID)
- Number - Unique identifier for each bag
- Number - Number of the container frame presently shown for this bag, or nil if no container frame is shown for this bag
local container = IsBagOpen(0)
if (IsBagOpen(0)) then
-- The backpack is open
_G["ContainerFrame" .. container]:Hide() -- But now its closed
- Even though the return is a number, it may be treated as a boolean for conditional logic:
- If the bag is open, the number returned will always evaluate to true
- If the bag is closed, the nil returned will always evaluate to false
- When open, bags appear as a ContainerFrame called ContainerFrame1, ContainerFrame2, etc.
- The number returned by this function informs you which ContainerFrame currently corresponds to this BagID
- ContainerFrame:GetID() returns the BagID value
Patch 1.11.0 / API (2006-06-19): Returns the BagID (number) of the corresponding ContainerFrame.
- Previously returned boolean (1 or nil).