Support for Lua added - patch from Mark Gossage
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7365 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e2c90c74a9
commit
127e49e03b
27 changed files with 2266 additions and 0 deletions
29
SWIG/Examples/test-suite/lua/exception_order_runme.lua
Normal file
29
SWIG/Examples/test-suite/lua/exception_order_runme.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
-- demo of lua swig capacilities (operator overloading)
|
||||
require("import") -- the import fn
|
||||
import("exception_order",true) -- import lib into global
|
||||
|
||||
-- catching undefined variables
|
||||
setmetatable(getfenv(),{__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
|
||||
|
||||
a = A()
|
||||
|
||||
function try1()
|
||||
a:foo()
|
||||
end
|
||||
|
||||
ok,ex=pcall(try1)
|
||||
assert(ok==false and swig_type(ex)==swig_type(E1()))
|
||||
|
||||
function try2()
|
||||
a:bar()
|
||||
end
|
||||
ok,ex=pcall(try2)
|
||||
assert(ok==false and swig_type(ex)==swig_type(E2()))
|
||||
|
||||
function try3()
|
||||
a:foobar()
|
||||
end
|
||||
ok,ex=pcall(try3)
|
||||
assert(ok==false and type(ex)=="string")
|
||||
-- the SWIG_exception is just an error string
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue