LPeg extension for the Defold game engine. LPeg is a pattern-matching library by Roberto Ierusalimschy for Lua.
The extension includes source code of LPeg 1.0.2 (MIT Licence).
Add the link to the latest release zip-archive as a library dependency in the Defold project configuration.
All operations are accessible through the global variable lpeg
.
local P = lpeg.P
local pattern = P'a' * P'b' ^ 0
local result = lpeg.match(pattern, 'abbc')
print(result) --> 4
This library is used by Narrator to parse the Ink language. You can check how its parser works here.