An nREPL server for Lua

Name Last Update
bin Loading commit data...
Changelog.md Loading commit data...
LICENSE Loading commit data...
Readme.md Loading commit data...
jeejah-0.1.0-1.rockspec Loading commit data...
jeejah-0.2.0-1.rockspec Loading commit data...
jeejah.lua Loading commit data...
monroe-lua-complete.el Loading commit data...


An nREPL server for Lua.

A what now?

The nREPL protocol allows developers to embed a server in their programs to which external programs can connect for development, debugging, etc.

The original implementation of the protocol was written in Clojure, and most clients assume they will connect to a Clojure server; however the protocol is quite agnostic about what language is being evaluated. It supports evaluating snippets of code or whole files with print and io.write redirected back to the connected client.

This library was originally written to add Emacs support to Bussard, a spaceflight programming game. See the file data/upgrades.lua.

Currently only tested with monroe as a client, which runs in Emacs. Other clients exist for Vim, Eclipse, and Atom, as well as several independent command-line clients; however these may require some adaptation to work with Lua.


$ luarocks install --local jeejah

Make sure ~/.luarocks/bin is on your $PATH.

Or from source:

$ luarocks install --local luasocket
$ luarocks install --local serpent
$ luarocks install --local bencode

You can symlink bin/jeejah to your $PATH or something.


You can launch a standalone nREPL server:

$ jeejah

Accepts --host and --port args. Also accepts --debug flag.

You can use it as a library too, of course:

local jeejah = require("jeejah")
local coro = jeejah.start(host, port, {debug=true, sandbox={x=12}})
while true do coroutine.resume(coro) end

The function returns a coroutine which you'll need to repeatedly resume in order to handle requests. Each accepted connection is stored in a coroutine internal to that function; these are each repeatedly resumed by the main coroutine.

Note that the sandbox feature is not well-tested or audited and should not be trusted to provide robust security.

You can also pass in a handlers table where the keys are custom nREPL ops you want to handle yourself.


The included monroe-lua-complete.el file adds support for completion to the Monroe client by querying the connected nREPL server for possibilities. Simply invoke completion-at-point (bound to C-M-i by default) when connected.


Lua 5.1 does not allow yielding coroutines from inside protected calls, which means you cannot use io.read, though LuaJIT and Lua 5.2+ allow it.


Copyright © 2016 Phil Hagelberg and contributors

Distributed under the MIT license; see file LICENSE