WoW:ItemLink: Difference between revisions

4 bytes removed ,  7 July 2010
Slightly faster and more precise itemString extraction function call and pattern
m (yank first header)
(Slightly faster and more precise itemString extraction function call and pattern)
Line 19: Line 19:
* <tt>"'''|r'''"</tt> &ndash; Restores color to normal
* <tt>"'''|r'''"</tt> &ndash; Restores color to normal


You can extract the itemString from a given itemLink with the following pattern:
You can extract the itemString from a given itemLink with the following function:


  local found, _, itemString = string.find(itemLink, "^|c%x+|H(.+)|h%[.*%]")
  local itemString = string.match(itemLink, "^|c%x+|H(item[%d:]+)|h%[")


Note: The format of the link is similar for enchant, spell and quest links, with merely the "itemstring" changing. See [[spellString]], [[enchantString]] and [[questString]]
Note: The format of the link is similar for enchant, spell and quest links, with merely the "itemstring" changing. See [[spellString]], [[enchantString]] and [[questString]]
Anonymous user