Problem Loading into game.
With my code changed to a repl.it tested URL Detection code the following function seems to be causing WoW to not get past the loading screen:
Code:
function URLFind(str) |
You have an infinite loop, likely caused by "url" being nil and continuing to be nil.
I'm not sure what your goal is, but this is insane for a url detection function. |
Quote:
|
Im going to see soon. I think its the While loop. But it still seems to be hanging.
Edit: Sigh... It was an infinite loop... It was because I converted a For Loop. Do you have a better way to detect the following URL types?: http://www.test.com/folder/subfolder/ www.test.com/folder/subfolder/ test.com/folder/subfolder/ test.com |
Ok I got it... I dont understand how but it was caused by a combo of the infinite loop and the regex match pattern. I am new to it and didnt realise normal regex's from other luas wouldnt neccesarily work.
Below is my modified working code. Code:
function URLFind(str) |
Given how broad your definition of a url is, you could probably try something like this..
Lua Code:
|
Quote:
I came up with this code: url = string.match(str, "[https?://]*[www%.]*[%w+]*[%w+%-]?[%w+%.]+%w+%"..URIs[cURL].."[/w%w+/]+", _x) pos = string.find(str, "[https?://]*[www%.]*[%w+]*[%w+%-]?[%w+%.]+%w+%"..URIs[cURL].."[/%w+/]+", _x) But for some reason it wont work in WoW. It works on Repl.it for lua to find an example address of www.cc-test.test.com It gets stuck on the loading screen. I return my function and it loads but will not detect that address. Or rather just part of it. |
I suppose a file path could be mistaken for a url, but you could either strip chat hyperlinks out of the text first or do some post-processing on the suspected urls to make sure they conform with what you want.
|
Well so far I appreciate your help... It got me seeing a few things.
I have it working on basic URLs and now my issue is that any address with the <word>-<word>.com for example or use the one above for like enjin links arent working. It grabs the ending <word>.com and i need it to grab all of it. The problem is that my complete correct code doesnt work in WoW for some reason. |
I should probably mention that you aren't using character classes correctly.
Something like "[www%.]" is the same as "[.w]" and matches a single character contained in the brackets, in this case either a "w" or a "." but not the literal string "www." |
Thats ok I think im just gonna go the long hard route. I will come back to regex later when I better understand it. Until then I am using my much bigger code that I know worked.
|
Lua doesn't actually use regex, but a different thing described here:
http://wowpedia.org/Pattern_matching http://www.lua.org/pil/20.1.html Personally I just use this pattern for URL matching: Code:
%l+://%S+ |
Yea I got help on StackOverflow and got a wonderful solution and I am sticking with it. I know of the difference of Luas Pattern matching vs Regex but dont 100% know how to deploy it. I am still learning.
I started LUA recently so I will get it over time though. |
All times are GMT -6. The time now is 03:41 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI