[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Weird re.lua compile() call syntax.
- From: Georgios Petsagourakis <petsagouris+lual@...>
- Date: Sat, 23 Nov 2013 06:34:29 +0000 (UTC)
Choonster TheMage <choonster.2010 <at> gmail.com> writes:
> The first part of line 22 is calling the `re.compile` function with a
> single string argument (parentheses are optional when you call a
> function with a single string/table literal as its only argument),
> which compiles a regular expression into a standard LPeg pattern. It
> then uses LPeg's overloaded `/` (division) operator to turn the
> pattern returned by `re.compile` into a function capture, which
> calls the function defined on lines 23-32 with the captures made by
> the pattern as arguments and uses the function's return values as the
> results of the capture. It then assigns this function capture to the
> new local variable `param`.
Amazing, thanks a lot for this.
You solved the '/' which was the most troubling point. Now I can go ahead
and figure out what the rest does ;)