How to get string.match correctly used?

I’v just use it as below in setup,but it just get e printed,Please tell me what’s wrong with it.


From the manual:

string.match (s, pattern [, init])

Looks for the first match of pattern in the string s. If it finds one, then match returns the captures from the pattern; otherwise it returns nil. If pattern specifies no captures, then the whole match is returned. A third, optional numerical argument init specifies where to start the search; its default value is 1 and can be negative.

You didn’t provide a capture, so all of your pattern is treated as the capture. Your pattern is “e”, and as it is found in the string it is returned.

What did you want it to do?

.@Codeslinger But the manual said it will return the capture…

What do you want it to do?
Look in a lua manual for patterns

For example

Will print ello