WoW:API GetInventoryItemLink: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (New document)
 
m (Move page script moved page API GetInventoryItemLink to API GetInventoryItemLink without leaving a redirect)
 
(15 intermediate revisions by 15 users not shown)
Line 1: Line 1:
<center>'''GetInventoryItemLink''' - ''Documentation by [[User:Flickering|Flickering]]''</center>
{{wowapi}} __NOTOC__


Get a link string for the specified item.
Get the [[itemLink]] for the specified item.
"itemLink" = GetInventoryItemLink("unit", slotId)


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 inventory slot to be queried, obtained via [[API GetInventorySlotInfo|GetInventorySlotInfo]].
:;slotId : [[InventorySlotId]] - The inventory slot to be queried, obtained via [[API GetInventorySlotInfo|GetInventorySlotInfo()]].
=== Returns ===
:link


:;link : String - The link string for the specified item, or nil if the slot is empty.
== Returns ==
----
;"itemLink" : [[itemLink]]- The item link for the specified item or
__NOTOC__
:nil, if the slot is empty.
{{Template:WoW API}}
 
[[Category:API Inventory Functions|GetInventoryItemLink]]
== Example ==
 
local mainHandLink = GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot"))
local _, _, _, _, _, _, itemType = GetItemInfo(mainHandLink)
DEFAULT_CHAT_FRAME:AddMessage(itemType)
 
<big>'''Result'''</big>
:Prints the subtype of the mainhand weapon - for example "Mace" or "Sword".

Latest revision as of 04:46, 15 August 2023

WoW API < GetInventoryItemLink

Get the itemLink for the specified item.

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

Arguments[edit]

("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[edit]

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

Example[edit]

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