Function string.find

Why the function string.find in this case returns 1,1 ?

s2 = "299439"
i, j = string.find(s2, ".")
print(i, j)

This function uses pattern matching for search. Pattern “.” means any symbol.
If you want to find a dot, use “%.”:

i, j = string.find(s2, "%.")
7 Likes

The Lua pattern matching syntax is documented here: Programming in Lua : 20.2

4 Likes