WoW:ItemLink: Difference between revisions

2 bytes removed ,  28 October 2010
m
no edit summary
(Slightly faster and more precise itemString extraction function call and pattern)
mNo edit summary
Line 5: Line 5:
In essence, they are [[itemString]]s with additional formatting to make in-game text controls display them as clickable hyperlinks.
In essence, they are [[itemString]]s with additional formatting to make in-game text controls display them as clickable hyperlinks.


  |cff9d9d9d|Hitem:7073:0:0:0:0:0:0:0|h[Broken Fang]|h|r
  |cff9d9d9d|Hitem:7073:0:0:0:0:0:0:0:80:0|h[Broken Fang]|h|r


Broken up in its components:
Broken up in its components:
Line 13: Line 13:
** The next three sets of two characters represent the red, green, and blue levels, just like HTML.
** The next three sets of two characters represent the red, green, and blue levels, just like HTML.
* <tt>"'''|H'''"</tt> &ndash; "Hyperlink link data starts here"
* <tt>"'''|H'''"</tt> &ndash; "Hyperlink link data starts here"
* <tt>"'''item:7073:0:0:0:0:0:0:0'''"</tt> &ndash; Read more at [[itemString]].
* <tt>"'''item:7073:0:0:0:0:0:0:0:0:0'''"</tt> &ndash; Read more at [[itemString]].
* <tt>"'''|h'''"</tt> &ndash; "End of link, text follows"
* <tt>"'''|h'''"</tt> &ndash; "End of link, text follows"
* <tt>"'''[Broken Fang]'''"</tt> &ndash; The actual text displayed
* <tt>"'''[Broken Fang]'''"</tt> &ndash; The actual text displayed
Line 21: Line 21:
You can extract the itemString from a given itemLink with the following function:
You can extract the itemString from a given itemLink with the following function:


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


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