Skip to content

a hack to let me work with some lua data more naturally

License

Notifications You must be signed in to change notification settings

disruptek/lunacy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

a hack to let me work with some lua data more naturally

Resources

License

Stars

Watchers

Forks

Languages