Lua improvements - Mark Gossage patch #1295168

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7472 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-09-20 20:05:06 +00:00
commit 76d58c55cb
9 changed files with 72 additions and 57 deletions

View file

@ -1,24 +1,25 @@
-- demo of lua swig capacilities (operator overloading)
require("import") -- the import fn
import("exception_order",true) -- import lib into global
import("exception_order") -- import lib into global
eo=exception_order --alias
-- catching undefined variables
setmetatable(getfenv(),{__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
a = A()
a = eo.A()
function try1()
a:foo()
end
ok,ex=pcall(try1)
assert(ok==false and swig_type(ex)==swig_type(E1()))
assert(ok==false and swig_type(ex)==swig_type(eo.E1()))
function try2()
a:bar()
end
ok,ex=pcall(try2)
assert(ok==false and swig_type(ex)==swig_type(E2()))
assert(ok==false and swig_type(ex)==swig_type(eo.E2()))
function try3()
a:foobar()