🌚Nelua is a typed Lua that compiles to C. If you already think in Lua but want a compiled cart with no interpreter inside it, this is the one.
- Template: cart_nelua - press "Use this template" and you have a working game.
- Docker image:
ghcr.io/notnullgames/null0-cart-nelua:latest - Your code:
cart/main.nelua, compiled with nelua + wasi-sdk clang - Bindings:
carts/nelua/null0.nelua(baked into the docker image for you) - WASI is available, so ordinary file and stdio calls work.
- See carts made with Nelua
- API docs for Nelua
building
You do not install nelua + wasi-sdk clang - the docker image has it, and the current null0 bindings, baked in. There is nothing in your project to keep in sync with the engine.
docker run --rm --user $(id -u):$(id -g) \
-v ./cart:/src -v ./webroot:/out \
ghcr.io/notnullgames/null0-cart-nelua:latest mygameThe template wraps that in npm start, which also serves the result and rebuilds when you save.
Nelua notes
require 'null0'. Nelua compiles to C, so it needs null0.h alongside null0.nelua.
a cart, in Nelua
This is carts/nelua/simple/main.nelua in the engine repo - the same file CI builds into the cart below, so it always compiles.
require 'null0' local function load() <cexport'load'> clear(BLUE) draw_circle(100, 100, 50, RED) draw_text(FONT_DEFAULT, 'hello from Nelua', 170, 92, WHITE) end -- callbacks (optional - implement as needed) -- -- local function update() <cexport'update'> endcarts/nelua/simple/main.nelua
callbacks
A cart implements the callbacks it cares about. In Nelua they look like this:
local function load() <cexport'load'> endSee anatomy of a cart for the full list and what each one is passed.