API GetInboxItem

From Wowpedia
Jump to: navigation, search

Provides information about an item attached to a message in the player's mailbox.

name, itemID, texture, count, quality, canUse  = GetInboxItem(index, itemIndex)

Arguments

index 
Integer - The index of the message to query, in the range [1,GetInboxNumItems()]
itemIndex 
Integer - The index of the item to query, in the range [1,ATTACHMENTS_MAX_RECEIVE]

Returns

name 
String - The localized name of the item
itemID 
Integer - Numeric ID of the item.
texture 
String - The path to the icon texture for the item
count 
Integer - The number of items in the stack
quality 
Integer - The quality index of the item
canUse 
Flag - 1 if the player can use the item, or nil otherwise

Example

Loop over all messages currently in the player's mailbox, get information about the items attached to them, and print it to the chat frame:

for i = 1, GetInboxNumItems() do
   -- An underscore is commonly used to name variables you aren't going to use in your code:
   local _, _, sender, subject, _, _, _, hasItem = GetInboxHeaderInfo(i)
   if hasItem then
      print("Message", subject, "from", sender, "has attachments:")
      for j = 1, ATTACHMENTS_MAX_RECEIVE do
         local name, itemID, texture, count, quality, canUse = GetInboxItem(i, j)
         if name then
            -- Construct an inline texture sequence:
            print("\128T"..texture..":0\128t", name, "x", count)
         end
      end
   else
      print("Message", subject, "from", sender, "has no attachments.")
   end
end

Details

  • As of 2.3.3 this function is bugged and the quality is always returned as -1. If you need to know the item's quality, get a link for the item using GetInboxItemLink, and pass the link to GetItemInfo.

Patch changes

  • Legion Patch 7.0.3 (2016-07-19): itemID return added between name and texture.

See also