Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import
- lua
- proc NimMain() {.importc.}
- proc get_hello*(state: PState): cint {.cdecl, exportc, dynlib.} =
- state.pushstring("Hello!")
- return 1
- let
- test* = [
- Treg(name: "get_hello", `func`: get_hello),
- Treg(name: "", `func`: nil)
- ]
- proc luaopen_test*(state: PState): cint {.cdecl, exportc, dynlib.} =
- NimMain()
- state.openlib(cstring"test", unsafeAddr(test[0]), cint(test.len-1))
- return 1
Advertisement
Add Comment
Please, Sign In to add comment