Hello there! We are conducting a survey to better understand the user experience in making a first edit. If you have ever made an edit on Gamepedia, please fill out the survey. Thank you!

API GetItemGem

From Wowpedia
Jump to: navigation, search

Takes an item with a gem in it, and an index from 1-3, and returns the name and link for the gem at that index.

itemName, itemLink = GetItemGem("name"|"itemlink", index) 



(itemName or "itemLink", index)
String - The Name of the Item, ex: "Hearthstone" (the item must be equiped or in your Inventory for this to work).
String - The itemLink, when Shift-Clicking items.
Number - The index of the desired gem. 1, 2, or 3


itemName, itemLink
String - The name of the gem at the specified index.
String - The gem's item Link; you will see the clickable Link instead of the string. (String, such as: "|cff0070dd|Hitem:24033:0:0:0:0:0:0:0|h[Solid Star of Elune]|h|r")


local itemLink = "|cff0070dd|Hitem:27773:3010:2729:2729:2739:0:0:0|h[Barbaric Legstraps]|h|r"
local gem1name, gem1Link = GetItemGem(itemLink, 1)
local gem2name, gem2Link = GetItemGem(itemLink, 2)
local gem3name, gem3Link = GetItemGem(itemLink, 3)
if gem1name then
  DEFAULT_CHAT_FRAME:AddMessage("Gem 1: "..gem1name..", Link: "..gem1Link)
if gem2name then
  DEFAULT_CHAT_FRAME:AddMessage("Gem 2: "..gem2name..", Link: "..gem2Link)
if gem3name then
  DEFAULT_CHAT_FRAME:AddMessage("Gem 3: "..gem3name..", Link: "..gem3Link)


As long as [Barbaric Legstraps], [Bright Living Ruby], and [Shifting Nightseye] all exist in your local cache, you will see the following lines in your chat frame:
Gem 1: Bright Living Ruby, Link: [Bright Living Ruby]
Gem 2: Bright Living Ruby, Link: [Bright Living Ruby]
Gem 3: Shifting Nightseye, Link: [Shifting Nightseye]


This function will ONLY retrieve data that is in your local cache.
If you have never seen the item that belongs to the Item ID or Item Link it will return nil.
Using the name may be ambiguous if you have more than one of the named item.