WoW:API GetItemIcon: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(New page: {{wowapi}}__NOTOC__ Return the icon texture for the item. itemIcon = GetItemIcon(itemID or "itemString" or "itemName" or "itemLink") == Parameters == === Arguments === :(itemId or "[[it...)
 
m (Move page script moved page API GetItemIcon to API GetItemIcon without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{wowapi}}__NOTOC__
{{wowapi}}__NOTOC__
Return the icon texture for the item.
Return the icon texture for the item.
  itemIcon = GetItemIcon(itemID or "itemString" or "itemName" or "itemLink")  
  itemIcon = GetItemIcon(itemID)  


== Parameters ==
== Parameters ==
=== Arguments ===
=== Arguments ===
:(itemId or "[[itemString]]" or "itemName" or "[[itemLink]]")
:(itemID)


:;itemId : Integer - The numeric ID of the item. ie. 12345
:;itemID : Integer - The numeric ID of the item. ie. 12345
:;[[itemString]] : String - The full item ID in string format, e.g. "item:12345:0:0:0:0:0:0:0".
:::Also supports partial [[itemString]]s, by filling up any missing ":x" value with ":0", e.g. "item:12345:0:0:0"
:;itemName : String - The Name of the Item, ex: "Hearthstone"
:::The item must have been equiped, in your bags or in your bank once in this session for this to work.
:;[[itemLink]] : String - The [[itemLink]], when Shift-Clicking items.


=== Returns ===
=== Returns ===
Line 20: Line 15:


== Example ==
== Example ==
local itemIcon = GetItemIcon("item:6948")
print("itemIcon :", itemIcon)
itemIcon = GetItemIcon("Hearthstone")
print("itemIcon :", itemIcon)
  itemIcon = GetItemIcon(6948)
  itemIcon = GetItemIcon(6948)
  print("itemIcon :", itemIcon)
  print("itemIcon :", itemIcon)


====Result====
====Result====
: prints Hearthstone icon 3 times - "Interface\\Icons\\INV_Misc_Rune_01".
: prints Hearthstone icon - "Interface\\Icons\\INV_Misc_Rune_01".
 
== Common usage ==


local itemIcon = GetItemIcon(link)
== Notes ==
* As of patch 4.0.1, this function requires an itemID, it will not work with item names or links.

Latest revision as of 04:46, 15 August 2023

WoW API < GetItemIcon

Return the icon texture for the item.

itemIcon = GetItemIcon(itemID) 

Parameters[edit]

Arguments[edit]

(itemID)
itemID
Integer - The numeric ID of the item. ie. 12345

Returns[edit]

"itemIcon"
itemIcon
String - The name and path of the icon texture of the item.

Example[edit]

itemIcon = GetItemIcon(6948)
print("itemIcon :", itemIcon)

Result[edit]

prints Hearthstone icon - "Interface\\Icons\\INV_Misc_Rune_01".

Notes[edit]

  • As of patch 4.0.1, this function requires an itemID, it will not work with item names or links.