
</p>
<pre class="example">
-- matches a numeral and captures its value
number = lpeg.R"09"^1 / tonumber

-- matches a list of numbers, captures their values
list = number * ("," * number)^0

-- auxiliary function to add two numbers
function add (acc, newvalue) return acc + newvalue end

-- folds the list of numbers adding them
sum = lpeg.Cf(list, add)

-- example of use
print(sum:match("10,30,43"))   --&gt; 83
</pre>


<h3><a name="cap-g"></a><code>lpeg.Cg (patt [, name])</code></h3>
<p>
Creates a <em>grou