PageRenderTime 46ms CodeModel.GetById 38ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

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

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