Javascript

  • See cart structure for more info about how callbacks work.
  • See API for more info about the null0 API.
  • See examples
  • WASI is exposed, and std and os are available
  • Check out the [JS template project](https://github.com/notnullgames/cart_js]
  • Your code is interpreted with quickjs compiled as a cart (full WASI & null0 API is available & global.)
  • Include main.wasm in your cart-zip, along with any assets you are using, and make a main.js.

A simple cart might look like this:

Which looks like this:

And then you can compile to a cart with:

mkdir -p cart
curl https://github.com/notnullgames/notnullgames/raw/refs/heads/main/examples/js/main.wasm > cart/mian.wasm
cp *.js cart
cd cart
zip -rq ../mygame.null0 .

See build.sh for an example of how I build for this example-site.

You need null0.h and null0.nelua

For zip command, you can skip packaging some files (like .DS_Store) with -x ".DS_Store" "__*" (after all the other options.)

If you want a similar language, but with more efficient cart-code, maybe try out assemblyscript. It's not exacly the same, and a bit less "loose", but the syntax is pretty similar, and it doesn't need to include the entire quickjs interpretor in your wasm.