New Lua examples - Mark Gossage patch #1295168
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7471 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
39119b2d07
commit
ef13b64b7e
12 changed files with 309 additions and 0 deletions
20
SWIG/Examples/lua/functest/runme.lua
Normal file
20
SWIG/Examples/lua/functest/runme.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
---- importing ----
|
||||
if string.sub(_VERSION,1,7)=='Lua 5.0' then
|
||||
-- lua5.0 doesnt have a nice way to do this
|
||||
lib=loadlib('example.dll','Example_Init') or loadlib('example.so','Example_Init')
|
||||
assert(lib)()
|
||||
else
|
||||
-- lua 5.1 does
|
||||
require('example')
|
||||
end
|
||||
|
||||
|
||||
x,y = 42,105
|
||||
print("add1 - simple arg passing and single return value -- ")
|
||||
print(example.add1(x,y))
|
||||
print("add2 - pointer arg passing and single return value through pointer arg -- ")
|
||||
print(example.add2(x,y))
|
||||
print("add3 - simple arg passing and double return value through return and ptr arg -- ")
|
||||
print(example.add3(x,y))
|
||||
print("add4 - dual use arg and return value -- ")
|
||||
print(example.add4(x,y))
|
||||
Loading…
Add table
Add a link
Reference in a new issue