1. I am piggybacking on the Altoholic mod to determine if someone posts an item link in chat, it checks to see if I have the item. My function to check is below.

     function GetNewCount(item)
         return String_StartsWith(AltoholicTabSearchStatus:GetText(),"0")   

    Basically, I execute Altoholic's search function without showing the UI and check the status text to see if it starts with 0. If it does not, I know I have the item.

    This code works if I call SetText with a literal String (e.g. "Felweed") but if I pass in item, it does not work, even though the edit box on the forum has the correct text.

    What I mean when I say it does not work, I mean if I pass in a String literal such as "Felweed" it works just fine. When attempting to parse an item link and passing in the result, which when I print the variable, it is the correct text with no outer whitespace, the search does not work.

    Here is my code for parsing the item link.

     function ParseChat(message, reset)
         if reset == true then
             itemsToReport = {};
             itemCount = 0;
             reported = false;
         if string.find(message, "|Hitem:") ~= nil then
             local start, endend = string.find(message, "|Hitem:")
             local link = string.sub(message, start)
             local count = 1
             for s in string.gmatch(link,"[^\%[]+") do
                 if count == 2 then
                 itemName = string.gsub(s, "]","")
                     if GetNewCount(itemName) == false then
                         itemsToReport[itemCount] = itemName;
                         itemCount = itemCount + 1;
                     ParseChat(string.sub(message, endend), false)
                 count = count + 1;       

    The text in the edit box gets escaped, if I'm not mistaken, meaning that each | becomes ||. That may be tripping you up?

    Edit: I've also already fixed your formatting, no need to keep messing with it =)

    Thanks for the quick response and the formatting :)

    You are right in a way, I printed string.len(item) and when it parses the item link, it prints Felweed, but the length is 11 so there is something to clean up. I passed a literal "Felweed" and it printed as 7.

    What would be the best way to strip those extra characters?

    I think that string.gsub("The |Felweed thingy", "||", "|") would probably be enough to replace each double | with a single one, it will return the new string, so you could pass that to your parser?

    The link comes across in chat, and I remove the item name from between the square brackets. I am confused as to why there would be pipes in it, could you explain?

    I have no idea, I don't know what is going on. I was just making a suggestion. Print the string character by character and figure out what's going on.

    Thats exactly what I did :)

    The problem was an additional |h|r tags in the item link I wasn't removing, just a bad algorithm on my part. The Print function parsed them as tags in the item link so they didn't show up.

    Thanks for the help man!

    No problem!