Luna

Luna is a Lua runtime environment that integrates the LuaJIT JIT compiler with a libev-based event loop. It is designed for building asynchronous system utilities and web services using a built-in standard library.

Architecture

Standard Library

Luna includes the following built-in modules:

Detailed documentation for each module is available in DOCS.md.

Building from Source

Prerequisites

To compile Luna and its dependencies, the following tools are required:

Build Process

  1. Compile Dependencies: This step builds all required libraries (LuaJIT, libev, wolfSSL, curl, etc.) as static archives.

    make requirements
    
  2. Compile Luna: Build the main runtime binary.

    make
    

The resulting luna binary is located in the root directory.

Quick Example

-- An asynchronous timer and logging example
log.use_colors(true)

log.info("Starting Luna runtime...")

core.set_timeout(1000, function()
    log.info("One second has elapsed.")
end)

-- Starting a simple web server
http.route("GET", "/", function(req, res)
    res:json({ status = "ok", runtime = "luna" })
end)

http.listen(8080)
http.run()

Libraries

Luna is made possible by these open-source libraries: