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

/trunk/Examples/lua/embed/runme.lua

#
Lua | 40 lines | 37 code | 0 blank | 3 comment | 0 complexity | 1f9c8eb31a1d25cdad4dd59c856bdba2 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. -- a test function to run the tests
  7. function do_tests()
  8. print("[lua] We are now in Lua, inside the do_tests() function")
  9. print("[lua] We will be calling example.gcd() and changing example.Foo")
  10. -- Call our gcd() function
  11. x = 42
  12. y = 105
  13. g = example.gcd(x,y)
  14. print("[lua] The gcd of",x,"and",y,"is",g)
  15. -- Manipulate the Foo global variable
  16. -- Output its current value
  17. print("[lua] Foo = ", example.Foo)
  18. -- Change its value
  19. example.Foo = 3.1415926
  20. -- See if the change took effect
  21. print("[lua] Foo = ", example.Foo)
  22. print("[lua] ending the do_tests() function")
  23. end
  24. function call_greeting()
  25. print("[lua] We are now in Lua, inside the call_greeting() function")
  26. example.greeting()
  27. print("[lua] ending the call_greeting() function")
  28. end