[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: lpeg.Carg() weirdness
- From: Sean Conner <sean@...>
- Date: Sat, 24 Jun 2017 19:10:17 -0400
I have an issue where I thought using lpeg.Carg() would solve the issue.
As a test, I wrote:
lpeg = require "lpeg"
pat = lpeg.P"a" * lpeg.Carg(1)
x = pat:match(pat)
print(x)
And I get:
lua: y.lua:4: reference to absent extra argument #1
stack traceback:
[C]: in function 'match'
y.lua:4: in main chunk
[C]: ?
Yet if I do:
x = pat:match(pat,1,nil)
print(x)
nil
So, what, exactly *is* the difference between the two calls? I mean,
besides the explicit nil being given in the second call.
-spc (Bummed about this ... )