[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lpeg table captures with non-string and dynamic keys
- From: Patrick Donnelly <batrick@...>
- Date: Sun, 18 Sep 2011 03:46:18 -0400
On Fri, Sep 16, 2011 at 3:28 PM, Patrick Donnelly <batrick@batbytes.com> wrote:
> I have a suggestion [...]
As a followup for those curious, I was able to find* a good solution for this.
Apparently you can just use rawset/table.insert and the folding
capture to insert values dynamically into the table. The key to this
is to use the anonymous group capture so that you can pass more than
two arguments to rawset. [Look at the "Name-value lists" example [1]
for inspiration.]
* With the help of daurnimator on IRC and re-reviewing the lpeg examples.
[1] http://www.inf.puc-rio.br/~roberto/lpeg
--
- Patrick Donnelly