summaryrefslogtreecommitdiff
path: root/Examples/lua/embed2/runme.lua
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2009-08-18 20:56:02 +0000
committerLorry <lorry@roadtrain.codethink.co.uk>2012-09-25 16:59:08 +0000
commit9f8a09ed743cedd9547bf0661d518647966ab114 (patch)
tree9c7803d3b27a8ec22e91792ac7f7932efa128b20 /Examples/lua/embed2/runme.lua
downloadswig-tarball-master.tar.gz
Imported from /srv/lorry/lorry-area/swig-tarball/swig-1.3.40.tar.gz.HEADswig-1.3.40master
Diffstat (limited to 'Examples/lua/embed2/runme.lua')
-rw-r--r--Examples/lua/embed2/runme.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/Examples/lua/embed2/runme.lua b/Examples/lua/embed2/runme.lua
new file mode 100644
index 0000000..73af9c5
--- /dev/null
+++ b/Examples/lua/embed2/runme.lua
@@ -0,0 +1,27 @@
+print "[lua] This is runme.lua"
+-- test program for embeded lua
+-- we do not need to load the library, as it was already in the intrepreter
+-- but lets check anyway
+assert(type(example)=='table',"Don't appear to have loaded the example module")
+
+-- note: we will copy the functions from example table into global
+-- this will help us later
+for k,v in pairs(example) do _G[k]=v end
+
+-- our add function
+-- we will be calling this from C
+function add(a,b)
+ print("[lua] this is function add(",a,b,")")
+ c=a+b
+ print("[lua] returning",c)
+ return c
+end
+
+function append(a,b)
+ print("[lua] this is function append(",a,b,")")
+ c=a..b
+ print("[lua] returning",c)
+ return c
+end
+
+