← History

Luerl 2012

Lua, reimagined as a pure-Erlang library running on the BEAM.

Paradigmsprocedural, functional, object-oriented, scripting, embeddable
Typingdynamic, strong, duck-typed
Extensions.lua
Created byRobert Virding

Influenced by: lua Erlang

Luerl is an implementation of standard Lua written entirely in Erlang/OTP, letting you run Lua programs directly on the BEAM. Rather than inventing a new language, it brings the small, fast, ubiquitous Lua scripting language into the Erlang and Elixir worlds as an embeddable, sandboxed library. The language you write is Lua; its host and runtime is the BEAM.

What makes it distinctive

History

Luerl was created by Robert Virding, one of the original co-inventors of Erlang and an early member of the Ericsson Computer Science Lab. He first announced it publicly on the erlang-questions mailing list on 18 February 2012, describing it as "a Lua interpreter written in Erlang which started off as a proof of concept and an experiment with handling mutable data, but it grew." At that early stage it was not a complete Lua, but it already implemented most of the language and a sizeable portion of the standard libraries.

The project sits alongside Virding's other language experiments on the BEAM, including LFE (Lisp Flavoured Erlang) and Erlog (a Prolog interpreter in Erlang). Luerl reflects a recurring theme in his work: hosting other languages and computational models on top of the Erlang virtual machine. Lua itself was designed in 1993 at PUC-Rio in Brazil by Roberto Ierusalimschy, Luiz Henrique de Figueiredo and Waldemar Celes as a small, portable, embeddable scripting language; Luerl is a faithful re-implementation of that language rather than a dialect of it.

The central technical challenge was reconciling Lua's mutable global state with Erlang's immutable data. Virding solved this by keeping the entire Lua state in a single data structure that is explicitly threaded through every operation of the parser, compiler and runtime, which are all written in clean Erlang/OTP. Because it runs purely on the BEAM without NIFs or C bindings, Luerl offers strong sandboxing and natural integration with Erlang and Elixir code, where the host (the "embedding program") can execute Lua snippets, read and write Lua variables, and expose Erlang functions to Lua.

Luerl originally tracked Lua 5.2 and later migrated toward Lua 5.3. It has matured from its proof-of-concept origins into an actively maintained library reaching the 1.x series, with stable releases such as v1.5.1 in late 2025, distributed under the Apache License 2.0. It has found use for scripting, configuration, game logic and user-supplied code in BEAM applications, and has been presented at venues including the Lua Workshop and Code BEAM conferences.

Resources

See it in Code Compare →