String.find being weird

Hello.

I am trying to replace some non-working asset links in an older game with the new format. But for whatever reason, I cannot. This is my code:

a="http://www.roblox.com/thumbs/asset.ashx?assetId="
b="http://www.roblox.com/thumbs/asset.ashx?assetId=626865471&x=420&y=420"
if string.find(b,a) then 
    print"yippee" 
else 
    print"no" 
end

Why does this not find a in b? It’s clearly in there.

Thanks,
– Ham

Could be wrong but I think you are looking at string.match.

string.find’s second argument is a string pattern, when you send in a, it’s being read as a pattern.

a should look like this:

a = "http://www%.roblox%.com/thumbs/asset%.ashx%?assetId="

% tells it to ignore special characters

1 Like

Seems to be a working fix. (limit)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.