WoW API: GetInventoryItemLink

From AddOn Studio
Revision as of 22:43, 8 May 2007 by WoWWiki>Luke1410 (changed the links to link to the correct pages and not the redirected ones and fixed a String declaration.)
Jump to navigation Jump to search

WoW API < GetInventoryItemLink

Get the itemLink for the specified item. Template:Code/Begin "itemLink" = GetInventoryItemLink("unit", slotId) Template:Code/End

Arguments

("unit", slotId)
"unit"
UnitId - A string representing the unit whose inventory is to be queried.
slotId
InventorySlotId - The inventory slot to be queried, obtained via GetInventorySlotInfo().

Returns

"itemLink"
itemLink- The item link for the specified item or
nil, if the slot is empty.

Example

local mainHandLink = GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot"))
local _, _, _, _, _, itemType = GetItemInfo(mainHandLink)
DEFAULT_CHAT_FRAME:AddMessage(itemType)

Result

Prints the subtype of the mainhand weapon - for example "Mace" or "Sword".