string.find() does not find strings in strings by default; it finds patterns in strings. More complete information can be found here, but here is the relevant part;
"." is a wildcard that can represent any character .
To find a string . , the period must be escaped with a percent sign, %.
EDIT: alternatively, you can pass a few extra arguments, find(pattern, init, plain) , which allows you to pass true as the last argument and search for simple strings. This will make your expression;
> i, j = string.find(s, '.', 1, true) -- plain search starting at character 1 > print(i, j) 6 6
Joachim Isaksson
source share