Guest User

lua experiments

a guest
Jun 18th, 2020
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.34 KB | None | 0 0
  1. import
  2.   lua
  3.  
  4.  
  5. proc get_hello(state: PState): cint {.cdecl.} =
  6.   state.pushstring("Hello!")
  7.  
  8.   return 1
  9.  
  10. const
  11.   test = [
  12.     Treg(name: "get_hello", `func`: get_hello),
  13.     Treg(name: "", `func`: nil)
  14.   ]
  15.  
  16. proc luaopen_test(state: PState): cint =
  17.   state.openlib(cstring"test", unsafeAddr(test[0]), cint(test.len-1))
  18.  
  19.   return 1
Add Comment
Please, Sign In to add comment