Returns the name of one of the player's bags. Returns nil for the bank and keyring, for bank bags while the player is not at the bank, and for empty bag or bank bag slots.


See also Container functions.

Signature:

name = GetBagName(container)

Arguments:

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

Returns:

  • name - Name of the container (string)

Examples:

-- Print the names of the player's bags to chat
for i=0,4 do
  local name = GetBagName(i)
  if name then
    print("Bag", i, ":", name)
  end
end