WoW:API GetInventoryItemLink: Difference between revisions
Jump to navigation
Jump to search
GetInventoryItemLink - Documentation by Flickering
(upgraded deprecated template) |
m (Robot: Removing selflinks) |
||
Line 29: | Line 29: | ||
=== Comments === | === Comments === | ||
The 2nd line of the example is used to strip down the link returned by the function into a format that [[API GetItemInfo|GetItemInfo]] will accept. You can't pass a link from | The 2nd line of the example is used to strip down the link returned by the function into a format that [[API GetItemInfo|GetItemInfo]] will accept. You can't pass a link from '''GetInventoryItemLink''' to [[API GetItemInfo|GetItemInfo]] directly. | ||
---- | ---- | ||
__NOTOC__ | __NOTOC__ |
Revision as of 21:50, 23 January 2007
← WoW API < GetInventoryItemLink
Get a link string for the specified item.
link = GetInventoryItemLink("unit", slotId)
Parameters
Arguments
- ("unit", slotId)
- unit
- String - The UnitId of the unit whose inventory is to be queried.
- slotId
- Numeric - The inventory slot to be queried, obtained via GetInventorySlotInfo.
Returns
- link
- String - The link string for the specified item, or nil if the slot is empty.
Example
Code
local mainHandLink = GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")) local _, _, itemCode = strfind(mainHandLink, "(%d+):") local _, _, _, _, _, itemType = GetItemInfo(itemCode) DEFAULT_CHAT_FRAME:AddMessage(itemType)
Results
Prints the subtype of the mainhand weapon - for example "Mace" or "Sword".
Comments
The 2nd line of the example is used to strip down the link returned by the function into a format that GetItemInfo will accept. You can't pass a link from GetInventoryItemLink to GetItemInfo directly.