try {
object.fireExeption();
} catch {
// doing something
}
I don't want to handle the exception inside C++ code, so does angelscript support it? any plan?
Exception inside script code
Does the angelscript code support throw exception and handle the exception? let's say (script code):
Unfortunately, AngelScript currently doesn't support handling exceptions in scripts, but it is on the list of things to do.
You can throw exceptions by registering a function like this:
However, it is not yet possible to catch the exception from within the scripts.
When an exception is thrown like this the context will immediately return from the Execute() method with the code asEXECUTION_EXCEPTION. The application can then examine the stack trace and values of variables if desired, but cannot resume the execution.
When the context is reused or released the stack will be cleaned up so no memory leaks will occur.
Catching exception from within the scripts is on the to-do list as SiCrane mentioned, but it is rather low priority at the moment. However, if anyone feels up to implement that support for me I'd gladly add it to the library.
Regards,
Andreas
void ThrowScriptException(const string &msg){ asIScriptContext *ctx = asGetActiveContext(); ctx->SetException(msg.c_str());}
However, it is not yet possible to catch the exception from within the scripts.
When an exception is thrown like this the context will immediately return from the Execute() method with the code asEXECUTION_EXCEPTION. The application can then examine the stack trace and values of variables if desired, but cannot resume the execution.
When the context is reused or released the stack will be cleaned up so no memory leaks will occur.
Catching exception from within the scripts is on the to-do list as SiCrane mentioned, but it is rather low priority at the moment. However, if anyone feels up to implement that support for me I'd gladly add it to the library.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement