Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 1.56 KB

README.md

File metadata and controls

51 lines (40 loc) · 1.56 KB

lunacy

Test Matrix GitHub release (latest by date) Minimum supported Nim version License Matrix

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...

Usage

--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}"""

Installation

$ nimph clone disruptek/lunacy

or if you're still using Nimble like it's 2012,

$ nimble install https://github.com/disruptek/lunacy

Documentation

See the documentation for the lunacy module as generated directly from the source.

License

MIT