From: <ol...@us...> - 2011-12-14 11:15:12
|
Revision: 12876 http://swig.svn.sourceforge.net/swig/?rev=12876&view=rev Author: olly Date: 2011-12-14 11:15:06 +0000 (Wed, 14 Dec 2011) Log Message: ----------- Escape literal > to > Modified Paths: -------------- trunk/Doc/Manual/Lua.html Modified: trunk/Doc/Manual/Lua.html =================================================================== --- trunk/Doc/Manual/Lua.html 2011-12-14 11:12:12 UTC (rev 12875) +++ trunk/Doc/Manual/Lua.html 2011-12-14 11:15:06 UTC (rev 12876) @@ -1133,13 +1133,13 @@ </p> <div class="targetlang"><pre> -> message() +> message() I died. stack traceback: [C]: in function 'message' stdin:1: in main chunk [C]: ? -> +> </pre></div> <p> @@ -1148,13 +1148,13 @@ </p> <div class="targetlang"><pre> -> function a() b() end -- function a() calls function b() -> function b() message() end -- function b() calls C++ function message(), which throws -> ok,res=pcall(a) -- call the function -> print(ok,res) +> function a() b() end -- function a() calls function b() +> function b() message() end -- function b() calls C++ function message(), which throws +> ok,res=pcall(a) -- call the function +> print(ok,res) false I died. -> ok,res=xpcall(a,debug.traceback) -- call the function -> print(ok,res) +> ok,res=xpcall(a,debug.traceback) -- call the function +> print(ok,res) false I died. stack traceback: [C]: in function 'message' @@ -1189,13 +1189,13 @@ </p> <div class="targetlang"><pre> -> throw_A() +> throw_A() object exception:A * stack traceback: [C]: in function 'unknown' stdin:1: in main chunk [C]: ? -> +> </pre></div> <p> To get a more useful behaviour out of SWIG you must either: provide a way to convert your exceptions into strings, or @@ -1236,14 +1236,14 @@ Then the following code can be used (note: we use pcall to catch the error so we can process the exception). </p> <div class="targetlang"><pre> -> ok,res=pcall(throw_exc) -> print(ok) +> ok,res=pcall(throw_exc) +> print(ok) false -> print(res) +> print(res) userdata: 0003D880 -> print(res.code,res.msg) +> print(res.code,res.msg) 42 Hosed -> +> </pre></div> <p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |