A C# (G)Lua lexer, parser, code analysis, transformation and code generation toolkit. For getting started, see the tutorial.
This is (another) rewrite from scratch based on Roslyn and The Complete Syntax of Lua with a few extensions:
&&
for and
;||
for or
;!=
for ~=
;!
for not
;// ...
;/* */
;127
/0x7F
);+=
, -=
, *=
, /=
, ^=
, %=
, ..=
;if a then b else c
and if a then b elseif c then d else e
;continue
which is a contextual keyword;continue
which is a full fledged keyword.TL;DR: This supports Lua 5.1, Lua 5.2, Lua 5.3, Lua 5.4, LuaJIT 2.0, LuaJIT 2.1, FiveM, GLua and Luau (Roblox Lua).
We have two NuGet packages:
Package | Stable | Latest |
---|---|---|
Main | ||
Experimental |
The best source for getting started is the tutorial.
LuaSyntaxOptions
preset and then create a LuaParseOptions
from it. If no preset is picked, LuaSyntaxOptions.All
is used by default;SourceText
from your code (using one of the SourceText.From
overloads);LuaSyntaxTree.ParseText
with your SourceText
/string
, (optional) LuaParseOptions
, (optional) path
and (optional) CancellationToken
;LuaSyntaxTree
.