👨‍💻 about me home CV/Resume 🖊️ Contact Github LinkedIn I’m a Haskeller 📝 Blog Freedom, privacy, tutorials… 🏆 Best of Fizzbuzz makex LuaX lsvg Calculadoira panda upp Haskell todo pwd TPG Nextcloud Git

🆕 February 2023: lsvg is a Lua interpreter specialized to generate SVG images.
🆕 since August 2022: LuaX is a Lua eXtended interpreter/cross compiler providing a bunch of useful modules (statically linked, no dependency). Nice integration with upp (new functions and modules available to extend upp macros) and Pandoc (LuaX can by loaded by the Pandoc Lua interpreter). LuaX was initially made for a soon released but yet confidential project about actor oriented programming!
💣 Kick GAFAMs out (✔️ ǝlƃooפ, ✔️ ʞooqǝɔɐℲ, ✔️ uozɐɯ∀): Stop giving our soul and money to evils, be free and respectful!
📰 Friday 2. April 2021: upp is a panda companion. It’s a Lua-scriptable lightweight text preprocessor.
🆕 since December 2020: Playing with the actor model in an embedded multicore context. C imperative components become C stream pure functions with no side effect ➡️ C low level programming with high level pure functional programming properties 🏆
📰 Saturday 30. January 2021: Playing with Pandoc Lua filters in Lua. panda is a lightweight alternative to abp providing a consistent set of Pandoc filters (text substitution, file inclusion, diagrams, scripts, …).
🆕 Sunday 24. May 2020: Working at EasyMile for more than 6 years. Critical real-time software in C, simulation and monitoring in Haskell ➡️ perfect combo! It’s efficient and funny ;-)

LuaX: Lua eXtended

Christophe Delord - http://cdelord.fr/luax

Lua eXtended

luax is a Lua interpreter and REPL based on Lua 5.4.4, augmented with some useful packages. luax can also produces standalone executables from Lua scripts.

luax runs on several platforms with no dependency:

luax can cross-compile scripts from and to any of these platforms.


luax is written in C and Lua and uses the Zig build system. Just download luax (https://github.com/CDSoft/luax) and run make:

$ git clone https://github.com/CDSoft/luax
$ cd luax
$ make                  # compile and test

Note: make will download a Zig compiler.


Installation of luax for the current host only

$ make install              # install luax to ~/.local/bin or ~/bin
$ make install PREFIX=/usr  # install luax to /usr/bin

luax is a single autonomous executable. It does not need to be installed and can be copied anywhere you want.

Installation of luax for all supported platforms (cross compilation support)

$ make install-all              # install luax to ~/.local/bin or ~/bin
$ make install-all PREFIX=/usr  # install luax to /usr/bin

LuaX artifacts

make install and make install-all install:

Precompiled binaries

It is usually highly recommended to build luax from sources. The latest binaries are available here: luax.tar.xz.

The Linux and Raspberry Pi binaries are linked statically with musl and are not dynamic executables. They should work on any Linux distributions.

Warning: There are Linux binaries linked with musl and glibc. The musl binaries are platform independent but can not load shared libraries. The glibc binaries can load shared libraries but may depend on some specific glibc versions on the host.


luax is very similar to lua and adds more options to compile scripts:

usage: luax [options] [script [args]]

General options:
  -h                show this help
  -v                show version information
  --                stop handling options

Lua options:
  -e stat           execute string 'stat'
  -i                enter interactive mode after executing
  -l name           require library 'name' into global 'name'
  -                 stop handling options and execute stdin
                    (incompatible with -i)

Compilation options:
  -t target         name of the targetted platform
  -t all            compile for all available LuaX targets
  -t list           list available targets
  -t list-luax      list available native LuaX targets
  -t list-lua       list available Lua/Pandoc targets
  -o file           name the executable file to create
  -r                use rlwrap (Lua/Pandoc targets only)

Scripts for compilation:
  file name         name of a Lua package to add to the binary

Lua and Compilation options can not be mixed.

Environment variables:

                    code executed before handling command line
                    options and scripts (not in compilation
                    mode). When LUA_INIT_5_4 is defined,
                    LUA_INIT is ignored.

  PATH              PATH shall contain the bin directory where
                    LuaX is installed

  LUA_PATH          LUA_PATH shall point to the lib directory
                    where the Lua implementation of LuaX
                    lbraries are installed

  LUA_CPATH         LUA_CPATH shall point to the lib directory
                    where LuaX shared libraries are installed

PATH, LUA_PATH and LUA_CPATH can be set in .bashrc or .zshrc
with « luax env ».
E.g.: eval $(luax env)

When compiling scripts (options -t and -o), the scripts shall contain tags (e.g. in comments) showing how the script is used by LuaX:

Scripts without tags are classified using a simplistic heuristic:

This heuristic should work for most of the Lua scripts but explicit tags are recommended.


# Native compilation (luax is a symlink to the luax binary of the host)
$ luax -o executable main.lua lib1.lua lib2.lua
$ ./executable      # equivalent to luax main.lua

# Cross compilation to MacOS x86_64
$ luax -o executable -t x86_64-macos-gnu main.lua lib1.lua lib2.lua

# Available targets
$ luax -t list
Targets producing standalone LuaX executables:

    aarch64-linux-gnu     path/luax-aarch64-linux-gnu
    aarch64-linux-musl    path/luax-aarch64-linux-musl
    aarch64-macos-gnu     path/luax-aarch64-macos-gnu
    i386-linux-gnu        path/luax-i386-linux-gnu
    i386-linux-musl       path/luax-i386-linux-musl
    i386-windows-gnu      path/luax-i386-windows-gnu.exe
    x86_64-linux-gnu      path/luax-x86_64-linux-gnu
    x86_64-linux-musl     path/luax-x86_64-linux-musl
    x86_64-macos-gnu      path/luax-x86_64-macos-gnu
    x86_64-windows-gnu    path/luax-x86_64-windows-gnu.exe

Targets based on an external Lua interpreter:

    lua                   path/lua
    lua-lua               path/lua
    lua-luax              path/lua
    luax                  path/luax
    luax-luax             path/luax
    pandoc                path/pandoc
    pandoc-lua            path/pandoc
    pandoc-luax           path/pandoc

Built-in modules

The luax runtime comes with a few builtin modules.

Some modules are heavily inspired by BonaLuna and lapp.

Shared libraries

LuaX is also available as a shared library. This shared library is a Lua module that can be loaded with require. It provides the same modules than the LuaX executable and can be used by a regular Lua interpreter (e.g.: lua, pandoc, …).


$ lua -l luax-x86_64-linux-gnu
Lua 5.4.4  Copyright (C) 1994-2022 Lua.org, PUC-Rio
> F = require "F"
> F.range(100):sum()
> F.show({x=1, y=2})
{x=1, y=2}
> F.show({x=1, y=2}, {indent=4})
    x = 1,
    y = 2,

Pure Lua modules

Some modules have been reimplemented in pure Lua (no LuaX dependency). The script lib/luax.lua can be reused in pure Lua programs:


luax is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

luax is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with luax.  If not, see <https://www.gnu.org/licenses/>.

For further information about luax you can visit

luax uses other third party softwares: