https://github.com/glassesneo/spellua
A high level LuaJIT binding for Nim
https://github.com/glassesneo/spellua
lua luajit nim
Last synced: 12 months ago
JSON representation
A high level LuaJIT binding for Nim
- Host: GitHub
- URL: https://github.com/glassesneo/spellua
- Owner: glassesneo
- License: wtfpl
- Created: 2024-07-02T15:29:57.000Z (over 1 year ago)
- Default Branch: develop
- Last Pushed: 2024-11-02T15:32:33.000Z (over 1 year ago)
- Last Synced: 2025-03-23T18:46:48.858Z (about 1 year ago)
- Topics: lua, luajit, nim
- Language: Nim
- Homepage:
- Size: 22.5 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: .github/README.md
- License: COPYING
Awesome Lists containing this project
README
# spellua
spellua is a high level LuaJIT bindings for Nim.
## Installation
```sh
nimble install spellua
```
## Usage
```nim
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()
```
```lua
-- 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.