Returns an item link for an item in the unit's inventory. The player's inventory is actually extended to include items in the bank, items in the player's containers and the player's key ring in addition to the items the player has equipped. The appropriate inventoryID can be found by calling the appropriate function.


See also Inventory functions, Hyperlink functions.

Signature:

link = GetInventoryItemLink("unit", slot)

Arguments:

  • unit - A unit to query; only valid for 'player' or the unit currently being inspected (string, unitID)
  • slot - An inventory slot number, as can be obtained from GetInventorySlotInfo. (number, inventoryID)

Returns:

  • link - An item link for the given item (string, hyperlink)

Examples:

-- Prints the item link for the item in the player's first bank slot
-- This only works when the bank info is cached, or when bank is open
local inventoryID = BankButtonIDToInvSlotID(1, false)
local link = GetInventoryItemLink("player", inventoryID)
print(link:gsub("|", "||"))

-- Prints the item link for the item in the THIRD BAG SLOT in the player's bank
-- This only works when the bank info is cached, or when the bank is open
local inventoryID = BankButtonIDToInvSlotID(7, 1)
local link = GetInventoryItemLink("player", inventoryID)
print(link:gsub("|", "||"))

-- Prints the item link for the item in the player's left-most bag slot, i.e.
-- the actual container that is in that slot. This will error if there is no
-- container in that slot.
local inventoryID = ContainerIDToInventoryID(4)
local link = GetInventoryItemLink("player", inventoryID)
print(link:gsub("|", "||")) 

-- Prints the item link for the item the player is wearing on their legs
local inventoryID = GetInventorySlotInfo("LegsSlot")
local link = GetInventoryItemLink("player", inventoryID)
print(link:gsub("|", "||")) 

-- Prints the item link for the item the player has in the first key-ring slot
local inventoryID = KeyRingButtonIDToInvSlotID(1)
local link = GetInventoryItemLink("player", inventoryID)
print(link:gsub("|", "||"))