Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/astrochili/defold-lpeg
LPeg extension for the Defold game engine.
https://github.com/astrochili/defold-lpeg
defold lpeg parsing
Last synced: about 2 months ago
JSON representation
LPeg extension for the Defold game engine.
- Host: GitHub
- URL: https://github.com/astrochili/defold-lpeg
- Owner: astrochili
- License: mit
- Created: 2020-06-23T09:06:08.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T12:19:34.000Z (almost 2 years ago)
- Last Synced: 2024-10-09T13:07:01.578Z (2 months ago)
- Topics: defold, lpeg, parsing
- Language: C
- Homepage:
- Size: 77.1 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-defold - LPeg - matching library. (Libraries / Programming Language)
README
![LPeg for Defold](https://user-images.githubusercontent.com/4752473/85421686-6481f780-b57d-11ea-839b-fdb4634e7ff8.jpg)
# LPeg for Defold
LPeg extension for the Defold game engine. [LPeg](http://www.inf.puc-rio.br/~roberto/lpeg/) is a pattern-matching library by [Roberto Ierusalimschy](http://www.inf.puc-rio.br/~roberto/) for Lua.The extension includes source code of LPeg 1.0.2 (MIT Licence).
## Installation
Add the link to the latest [release zip-archive](https://github.com/astrochili/defold-lpeg/releases) as a [library dependency](http://www.defold.com/manuals/libraries/) in the Defold project configuration.
## Usage
All operations are accessible through the global variable ```lpeg```.
```lua
local P = lpeg.Plocal pattern = P'a' * P'b' ^ 0
local result = lpeg.match(pattern, 'abbc')print(result) --> 4
```## Narrator
This library is used by [Narrator](https://github.com/astrochili/narrator) to parse the Ink language. You can check how its parser works [here](https://github.com/astrochili/narrator/blob/master/narrator/parser.lua).