/trunk/Examples/lua/embed2/runme.lua
Lua | 27 lines | 24 code | 0 blank | 3 comment | 0 complexity | ea0f59bac7e39a7360dc9ce972236b67 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-- note: we will copy the functions from example table into global 8-- this will help us later 9for k,v in pairs(example) do _G[k]=v end 10 11-- our add function 12-- we will be calling this from C 13function add(a,b) 14 print("[lua] this is function add(",a,b,")") 15 c=a+b 16 print("[lua] returning",c) 17 return c 18end 19 20function append(a,b) 21 print("[lua] this is function append(",a,b,")") 22 c=a..b 23 print("[lua] returning",c) 24 return c 25end 26 27