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 mygame

The 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'> end
carts/nelua/simple/main.nelua

callbacks

A cart implements the callbacks it cares about. In Nelua they look like this:

local function load() <cexport'load'> end

See anatomy of a cart for the full list and what each one is passed.