Jump to content
  • Advertisement
Sign in to follow this  

Nested Context Calls?

This topic is 1598 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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? 

Share this post

Link to post
Share on other sites

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

Edited by iraxef

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!