View Single Post
03-21-13, 03:31 AM   #31
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by fRodzet View Post
Lua Code:
  1. local linkType = strmatch(linkData, "|H(.-):")

doesn't seem to work.. and i don't quiet get, why it "should" work either?

string.split(":", linkData) makes also way more sense in my head :P
If your string looks like this:
"|Hitem:12345:0:1:2:3|h[Random Item of the X]|h"

...then string.split on colons returns:
  1. "|Hitem"
  2. "12345"
  3. "0"
  4. "1"
  5. "2"
  6. "3|h[Random Item of the X]|h"

...whereas string.match to capture what's between the first "|H" and the first following ":" returns only "item":
|Hitem:12345:0:1:2:3|h[Random Item of the X]|h
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote