lpeg.C

Creates a simple capture

Prototype

lpeg.C (patt)

Description

Creates a simple capture, which captures the substring of the subject that matches patt. The captured value is a string. If patt has other captures, their values are returned after this one.

For example:

digits = lpeg.R ("09")
hp = lpeg.P ("You gain ") * lpeg.C (digits^1) * " hp."
print (lpeg.match (hp, "You gain 300 hp.")) --> 300

Lua functions

Topics