WoW:API GetInventoryItemLink: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Kill "documentation by".)
m (changed the links to link to the correct pages and not the redirected ones and fixed a String declaration.)
Line 1: Line 1:
{{wowapi}}
{{wowapi}} __NOTOC__


Get a link string for the specified item.
Get the [[itemLink]] for the specified item.
{{Code/Begin}}
"itemLink" = GetInventoryItemLink("unit", slotId)
{{Code/End}}


link = GetInventoryItemLink("unit", slotId)
== Arguments ==
== Parameters ==
=== Arguments ===
:("unit", slotId)
:("unit", slotId)


:;unit : String - The [[API TYPE UnitId|UnitId]] of the unit whose inventory is to be queried.
:;"unit" : [[UnitId]] - A string representing the unit whose inventory is to be queried.
:;slotId : Numeric - The [[API TYPE InventorySlotID|inventory slot]] to be queried, obtained via [[API GetInventorySlotInfo|GetInventorySlotInfo]].
:;slotId : [[InventorySlotId]] - The inventory slot to be queried, obtained via [[API GetInventorySlotInfo|GetInventorySlotInfo()]].


=== Returns ===
== Returns ==
:;link : String - The link string for the specified item, or nil if the slot is empty.
;"itemLink" : [[itemLink]]- The item link for the specified item or
:nil, if the slot is empty.


== Example ==
== Example ==


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


=== Results ===
<big>'''Result'''</big>
 
:Prints the subtype of the mainhand weapon - for example "Mace" or "Sword".
Prints the subtype of the mainhand weapon - for example "Mace" or "Sword".
 
__NOTOC__

Revision as of 22:43, 8 May 2007

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".