1
 local ct = s:find('[ \t]', 80)

find function in Lua is generally used to find a particular pattern in a given string. In above line of code, we are passing '[ \t]' as the pattern to find along with 80.

What does it mean to pass [ \t] as the pattern to find and where is this 80 coming from? As far as I know, find function takes only two parameters i.e the string and the pattern to find.

Thanks

1 Answer 1

1

The pattern [ \t] matches one space or one tab.

The match is attempted starting at position 80 in the given string.

string.find accepts two optional arguments besides the string and the pattern.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.