Installing Full Moon
Full Moon is available as a Rust crate on crates.io. This guide will walk you through adding it to your project and configuring the feature flags for your target Lua version.Basic Installation
Add Full Moon to Cargo.toml
Add the following line to your This installs Full Moon with the default features (Lua 5.1 support with serde serialization).
Cargo.toml under [dependencies]:Cargo.toml
Feature Flags
Full Moon supports multiple Lua versions through Cargo feature flags. By default, only Lua 5.1 is supported.Available Features
serde
Default: EnabledEnables serialization and deserialization support for AST nodes using serde.
lua52
Enables Lua 5.2 syntax support including:
gotostatements- Labels
::label::syntax
lua53
Enables Lua 5.3 syntax support (includes lua52 features).
lua54
Enables Lua 5.4 syntax support including:
- To-be-closed variables (
<const>,<close>) - Attributes
luau
Enables Luau (Roblox Lua) syntax support including:
- Type annotations
- Compound assignments (
+=,-=, etc.) - Interpolated strings
- Generics and type packs
luajit
Enables LuaJIT-specific syntax support.
cfxlua
Enables CfxLua (FiveM) syntax support (includes lua54 features).
Combining Features
You can enable multiple features simultaneously:When you enable a higher Lua version feature (e.g.,
lua54), it automatically includes all lower versions (lua53, lua52). You only need to specify the highest version you need.Version Selection at Runtime
When multiple Lua versions are enabled, Full Moon automatically selects the most complete version. You can also manually specify the version:Verifying Installation
Create a simple test to verify Full Moon is working:src/main.rs
Next Steps
Quick Start Guide
Learn how to parse Lua code and traverse the AST