Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
(This function works for the ammo slot also.)
(13 intermediate revisions by 11 users not shown)
Line 1: Line 1:
 
{{wowapi}} __NOTOC__
<center>'''GetInventoryItemLink''' - ''Documentation by [[User:Flickering|Flickering]]''</center>
 
   
Get a link string for the specified item.
+
Get the [[itemLink]] for the specified item.
 
"itemLink" = GetInventoryItemLink("unit", slotId)
   
 
== Arguments ==
link = GetInventoryItemLink("unit", slotId)
 
== 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 ==
  +
;"itemLink" : [[itemLink]]- The item link for the specified item or
:link
 
  +
:nil, if the slot is empty.
   
  +
== Example ==
:;link : String - The link string for the specified item, or nil if the slot is empty.
 
  +
----
 
  +
local mainHandLink = GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot"))
__NOTOC__
 
  +
local _, _, _, _, _, _, itemType = GetItemInfo(mainHandLink)
{{Template:WoW API}}
 
  +
DEFAULT_CHAT_FRAME:AddMessage(itemType)
[[Category:API Functions|GetInventoryItemLink]]
 
  +
[[Category:API Inventory Functions|GetInventoryItemLink]]
 
  +
<big>'''Result'''</big>
[[Category:API Item Functions|GetInventoryItemLink]]
 
  +
:Prints the subtype of the mainhand weapon - for example "Mace" or "Sword".

Revision as of 20:23, 1 April 2009

Get the itemLink for the specified item.

"itemLink" = GetInventoryItemLink("unit", slotId)

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