String.find() help

image
I am confused why it returns that 1,1 when . clearly resides at the 4th index not the first?

Change it to:

local a, b = string.find("lol.com", "%.")

The reason for needing the percent sign is to escape the string pattern. The . character is a string pattern which means any character. Therefore, it is getting the letter “l,” rather than the desired “.”

1 Like

Oh right I forgot . was a string pattern my bad lol, thanks cuz the % nullifies the effect as a string pattern and searches for the string literally, thanks :smiley:

You should mark my response as solution. Thanks and good luck! :slight_smile:

Thank you so much :slight_smile: and good luck aswell!(will mark as response)