🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Nested Context Calls?

Started by
1 comment, last by PhilCK 10 years ago

I have an error that I keep getting when I call Prepare() with error asCONTEXT_ACTIVE (and then Execute() asCONTEXT_NOT_PREPARED).

I guess this is because I'm nesting calls into the AS code, is this possible?

My application has an event system on the C++ side and I'm trying to route event calls from both C++ and AS through the same event manager, however some events are instant, so a program flow might look like this.

C++ : Game Object Manager will call the components update methods (as scripts).
AS : component fires instant event.
C++ : Delivers events to all subscribers (both C++ and AS). !!!ERROR!!!
AS : Finishes rest of update method.

Is this possible? Or do I have to finish the execution of the current AS method?

Advertisement

See PushState() and PopState() here: http://www.angelcode.com/angelscript/sdk/docs/manual/doc_finetuning.html

I believe it's recommended that you use those if you know you need to do a 'quick nested trip' into script. This way you won't have to potentially spin up a whole new context.

I myself bind a 'spawn coroutine' sort of function where my flow is:

AS: script calls spawn()

C++: we need to execute a new script function while the previous one is still running. spin up a new context and call Execute() on it

Thank you.

This topic is closed to new replies.

Advertisement