We're aiming for a high-quality integration with Lua, but it might take a little time to get there; point being, this API is a work in progress...
--define:lunacyLuaJIT
to use luajit.so
; else we'll use a 5.[01] library.
# instantiate a lua virtual machine
let vm =
# the lua just returns a table
lua:
return {
foo = "bar",
bif = "baz",
bam = 34,
}
# pop the table from the lua vm
var s = popStack vm
# we can index it as a table, render it as Lua, etc.
assert s["foo"] == "bar"
assert s["bam"] == 34
assert s["bam"] == 34.0
assert $s == """{bif = "baz", foo = "bar", bam = 34}"""
$ nimph clone disruptek/lunacy
or if you're still using Nimble like it's 2012,
$ nimble install https://github.com/disruptek/lunacy
See the documentation for the lunacy module as generated directly from the source.
MIT