Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

API IsBagOpen

Last wiki revision 2020-02-27

container = IsBagOpen(BagID) CloseBag(id)

  • BagID : Number - Unique identifier for each bag
  • container : 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 end

  • 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

Source

https://warcraft.wiki.gg/wiki/API_IsBagOpen · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.