lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Jun 24, 2017 at 4:10 PM, Sean Conner <sean@conman.org> wrote:
>
>         x = pat:match('a')
>         x = pat:match('a',1,nil)
>
>   So, what, exactly *is* the difference between the two calls?  I mean,
> besides the explicit nil being given in the second call.

According to the docs, lpeg.Carg(n) produces "the value of the nth
extra argument to lpeg.match (matches the empty string)"

http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html#captures

Therefore:  Carg(n) requires that there be at least n extra arguments.
The difference between the two calls is that the first call provides
no extra arguments, whereas the second call provides the required one
extra argument.

> -spc (Bummed about this ... )

Why?  What are you trying to do?

-Parke