No description
Find a file
2024-11-03 00:29:51 +09:00
.github docs: update README.md 2024-11-02 21:37:31 +09:00
src chore: improve call macro to raise assertion instead of crash if 2024-11-03 00:29:51 +09:00
tests BREAKING CHANGE: LuaDriver is now object type and has init() 2024-11-02 21:35:44 +09:00
.gitignore 🔧 config: remove nim.cfg 2024-09-14 21:14:32 +09:00
COPYING 🎉 First commit 2024-07-02 23:17:29 +09:00
spellua.nimble 🔧 config: introduce atlas 2024-09-11 01:09:29 +09:00

spellua

spellua is a high level LuaJIT bindings for Nim.

Installation

nimble install spellua

Usage

import
  std/os,
  spellua

let driver = LuaDriver.init()
driver.loadFile(getAppDir()/"sample.lua")

# Get lua variables
echo driver.getString(Name)
echo driver.getInteger(Size)
echo driver.getBoolean(Enable)

# Bind lua variables
driver.bindString(V1)
echo V1

# Sync nim variables to lua runtime
let syncVal = 5
driver.syncInteger(syncVal)
echo driver.getInteger(syncVal)

# Call lua function (partly supported)
driver.call("PrintValue", 100)

driver.close()
-- sample.lua
Name = [[=================
Hello World
=================]]

Size = 640

Enable = true

V1 = "bound variable"

---@param value integer
function PrintValue(value)
  print(value)
end

License

spellua is licensed under the WTFPL license. See COPYING for details.