Indeed. It appears that this would work just fine without relying on C++11.
This feature is definitely something that I'll add to the library as soon as possible.
Indeed. It appears that this would work just fine without relying on C++11.
This feature is definitely something that I'll add to the library as soon as possible.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
I've implemented the exception translation callback in revision 2481.
void TranslateException(asIScriptContext *ctx, void* /*userParam*/)
{
try
{
// Retrow the original exception so we can catch it again
throw;
}
catch( std::exception &e )
{
// Tell the VM the type of exception that occurred
ctx->SetException(e.what());
}
catch(...)
{
// The callback must not allow any exception to be thrown, but it is not necessary
// to explicitly set an exception string if the default exception string is sufficient
}
}
// Register the callback with the engine
engine->SetTranslateAppExceptionCallback(asFUNCTION(TranslateException), 0, asCALL_CDECL);
I decided to have the callback registered with the engine rather than the context, as Boost113 had suggested in his implementation. I figured the callback is related to the registered functions, and not the VM that is calling them.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game