Lilush documentation reference

Overview

Lilush is a statically compiled LuaJIT interpreter for Linux that bundles a curated collection of Lua modules and C libraries. It has two builds:

  1. lilu - A batteries-included LuaJIT runtime with networking, crypto, terminal I/O, and system utilities

  2. lilush - A feature-rich Linux shell Lilush Shell, built on top of lilu

Lilush is by design Linux only and not portable.

Documentation index

Entry Points

The lilush binary has multiple entry modes:

  1. Interactive shell: lilush (no args)

  2. Script execution: lilush /path/to/script.lua [args]

    • Example: lilush myscript.lua arg1 arg2

  3. Lua code execution: lilush -e '<lua-code>'

    • Executes Lua code directly (like python -e or ruby -e)

    • Example: lilush -e "print('Hello from Lua')"

    • Example: lilush -e "local std = require('std'); print(std.fs.cwd())"

  4. Shell command mode: lilush -c <shell-commands>

    • Executes lilush shell commands (mimics bash -c behavior)

    • Example: lilush -c "echo hello"

    • Note: This runs shell commands, NOT Lua code. Use -e for Lua code.

  5. Built-in mode: Symlinked as builtin name executes that builtin

  6. Version: lilush -v

See buildgen/entrypoints/lilush/main.c for implementation.

The minimal build, lilu has only (2), (3) and (6) entry modes from the above.

Common Gotchas

  1. LuaJIT is not Lua 5.3+ - Uses Lua 5.1 + some 5.2 compat.

  2. Static linking - All dependencies must be statically linkable. Dynamic loading (require with .so) won't work in final binary.

  3. FFI disabled - LuaJIT FFI is disabled (-DLUAJIT_DISABLE_FFI) for size/security. Use C modules instead.

  4. Built with musl libc, not glibc.