Install
Luerl works as a library embedded in a host program called the embedding program. The host program can invoke functions to execute a piece of Lua code, can read and write Lua variables, and call Erlang functions by Lua code.
Through the use of Erlang, Luerl can be augmented to cope with a wide range of different domains, creating a customized language sharing a syntactical framework.
Installing Luerl
Luerl implements standard Lua 5.3 in pure Erlang. To start using the project you need to include the luerl library as a new dependency on your OTP application. You need a recent Erlang/OTP release installed — the CI matrix currently runs Erlang/OTP 24 through 27, which is the supported range.
Rebar
With Rebar 3, you can either install luerl from hex.pm or from GitHub directly (for more info on Rebar dependencies, see the dependency documentation).
Add luerl as a dependency to your project rebar.config file using one of the two options below.
Hex
{deps, [luerl]}.
GitHub
{deps, [{luerl, {git, "https://github.com/rvirding/luerl.git", {branch, "develop"}}}]}.
Mix (Elixir)
Luerl is a rebar3 library, but Elixir projects can depend on it via hex.pm like any other package. Add luerl to the deps list in your mix.exs:
def deps do [ {:luerl, "~> 1.5"} ] end
The current hex.pm release is 1.5.1.
Erlang.mk
Or use Erlang.mk to setup quickly your environment, build the code and project release.
Create a Makefile and include luerl to the project dependencies.
DEPS = luerl
Source code
$ git clone https://github.com/rvirding/luerl.git
Building from source and running the tests
Contributors and anyone building from develop use rebar3, the same tool the project's CI uses:
$ cd luerl $ rebar3 compile $ rebar3 do eunit, ct --cover, cover $ rebar3 dialyzer
rebar3 eunit runs the unit tests and rebar3 ct the common test suites; --cover and cover generate a coverage report. rebar3 dialyzer runs the static analysis — it is part of CI, so keep it clean before opening a pull request.
Getting started
For a quick starting tutorial we're going to use Erlang.mk to setup quickly our environment, build our code and start or stop the project release.
Erlang.mk is very easy to setup: create a folder, put Erlang.mk in it, and write a Makefile:
include erlang.mk
For a step by step:
$ mkdir luerl_demo
$ cd luerl_demo
$ curl https://erlang.mk/erlang.mk -o erlang.mk
Create a Makefile and copy the next code snippet, there you can make the correct changes to reflect your project needs.
PROJECT = luerl_demo DEPS = luerl include erlang.mk
$ make
From that point you can create an src/ folder or start using http://erlang.mk/ templates - User guide.