Use of "("?) in Lua with string.find and the value that it returns -


a, i, c = string.find(s, '"("?)', + 1) 

what role of ? here? believe checking double quotes not understand use of "("?).

i read string.find returns starting , ending index of matched pattern. per above line of code, a, i , c, 3 values being returned. third value being returned here?

? matches optional character, i.e, 0 or 1 occurrence of character. pattern "("?) matches ", followed optional ", i.e, matches either " or "". note match "?(zero or 1 ") captured.

as return value of string.find(), string.find():

if pattern has captures, in successful match captured values returned, after 2 indices.

the capture third return value, when there successful match.


Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -