Returns information about special bag types that can hold a given item. The meaning of bagType varies depending on the item:

  • If the item is a container, bagType indicates which kinds of items the container is limited to holding; a bagType of 0 indicates the container can hold any kind of item.
  • If the item is not a container, bagType indicates which kinds of specialty containers can hold the item; a bagType of 0 indicates the item can only be put in general-purpose containers.

See also Item functions, Container functions.

Signature:

bagType = GetItemFamily(itemID) or GetItemFamily("itemName") or GetItemFamily("itemLink")

Arguments:

  • itemID - An item's ID (number)
  • itemName - An item's name (string)
  • itemLink - An item's hyperlink, or any string containing the itemString portion of an item link (string)

Returns:

  • bagType - Bitwise OR of bag type flags: (number, bitfield)
    • 0x0001 - Quiver
    • 0x0002 - Ammo Pouch
    • 0x0004 - Soul Bag
    • 0x0008 - Leatherworking Bag
    • 0x0010 - Inscription Bag
    • 0x0020 - Herb Bag
    • 0x0040 - Enchanting Bag
    • 0x0080 - Engineering Bag
    • 0x0100 - Keyring
    • 0x0200 - Gem Bag
    • 0x0400 - Mining Bag
    • 0x0800 - Unused
    • 0x1000 - Vanity Pets
    • 0x2000 - Unused
    • 0x4000 - Unused
    • 0x8000 - Tackle Box
    • 0x10000 - Cooking Bag

Examples:

function CanGoInBag(item, bag)
   -- Get the item's family
   local itemFamily = GetItemFamily(item)
   
   -- If the item is a container, then the itemFamily should be 0
   local equipSlot = select(9, GetItemInfo(item))
   if equipSlot == "INVTYPE_BAG" then
      itemFamily = 0
   end

   -- Get the bag's family
   local bagFamily = select(2, GetContainerNumFreeSlots(bag))

   return bagFamily == 0 or bit.band(itemFamily, bagFamily) > 0
end