[lua] Added a typemap DISOWN for SWIGTYPE* and SWIGTYPE[], and support for %delobject feature.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10326 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
97b910d726
commit
11647d87e8
14 changed files with 377 additions and 19 deletions
|
|
@ -61,3 +61,36 @@ for i=1,3 do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- this is a bit crazy, but it shows obtaining of the stacktrace
|
||||
function a()
|
||||
b()
|
||||
end
|
||||
function b()
|
||||
t:message()
|
||||
end
|
||||
print [[
|
||||
Now lets call function a()
|
||||
which calls b()
|
||||
which calls into C++
|
||||
which will throw an exception!]]
|
||||
ok,res=pcall(a)
|
||||
if ok then
|
||||
print " that worked! Funny"
|
||||
else
|
||||
print(" call failed with error:",res)
|
||||
end
|
||||
print "Now lets do the same using xpcall(a,debug.traceback)"
|
||||
ok,res=xpcall(a,debug.traceback)
|
||||
if ok then
|
||||
print " that worked! Funny"
|
||||
else
|
||||
print(" call failed with error:",res)
|
||||
end
|
||||
print "As you can see, the xpcall gives a nice stacktrace to work with"
|
||||
|
||||
|
||||
ok,res=pcall(a)
|
||||
print(ok,res)
|
||||
ok,res=xpcall(a,debug.traceback)
|
||||
print(ok,res)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue