PageRenderTime 53ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/lua/embed2/runme.lua

#
Lua | 27 lines | 24 code | 0 blank | 3 comment | 0 complexity | ea0f59bac7e39a7360dc9ce972236b67 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. print "[lua] This is runme.lua"
  2. -- test program for embeded lua
  3. -- we do not need to load the library, as it was already in the intrepreter
  4. -- but lets check anyway
  5. assert(type(example)=='table',"Don't appear to have loaded the example module")
  6. -- note: we will copy the functions from example table into global
  7. -- this will help us later
  8. for k,v in pairs(example) do _G[k]=v end
  9. -- our add function
  10. -- we will be calling this from C
  11. function add(a,b)
  12. print("[lua] this is function add(",a,b,")")
  13. c=a+b
  14. print("[lua] returning",c)
  15. return c
  16. end
  17. function append(a,b)
  18. print("[lua] this is function append(",a,b,")")
  19. c=a..b
  20. print("[lua] returning",c)
  21. return c
  22. end