lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>>>>> "AG" == Alexander Gladysh <agladysh@gmail.com> writes:

 >> >> int my_func( lua_State *L ) {
 >> >> try {
 >> >> // blah-blah, possible call funcs from some library
 >> >> // call to some Lua function raising error
 >> >> // blah, once again
 >> >> }
 >> >> catch( myexception ) { /* do some great work */ }
 >> >> catch( void* ) { throw; /* conceivably Lua exception? */ }
 >> >> catch( ... ) { /* general error suicide ;) */ }
 >> >> }

 >> >> using 'catch( void* )' is weird a lot, no one cannot be sure an
 >> >> another code isn't raising somthing casting to void*.

 AG> Why would you want to catch Lua exceptions outside of Lua code? Why
 AG> not use pcall?

 >> I don't want, I want to pass them up. I want to catch everything
 >> but Lua's ones

 AG> I see. One option is to insert pcall inside try block. It should catch
 AG> Lua exceptions leaving other exceptions to the outer catch'es (think
 AG> of it as of equivalent of nesting one try-catch inside another).

I guess you're about lua_cpcall() ;) I'm calling near 10-20
lua_* functions messed with the other code in the hundreds of my
functions. it seems to be not an easy way to wrap the all calls
with lua_cpcall() :) 

-- 
Yours sincerely, Eugeny.
Doctor Web, Ltd. http://www.drweb.com
+79119997425