Skip to content

Is it possible to suspend a running Rhai script and resume it later? #570

Answered by schungx
casey asked this question in Q&A
Discussion options

You must be logged in to vote

Not at this time. You're asking for async (which is essentially suspend-and-resume). Rhai is not async.

You have a few choices:

  1. Use another scripting language that is async, such as https://github.com/rune-rs

  2. Run the script in one thread, the rendering engine in another, using a channel to bind the two (check out the threading example)

  3. Move your render loop outside of the script. Call the script during each frame (or spawn a new engine during each frame)

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@schungx
Comment options

@casey
Comment options

@schungx
Comment options

@casey
Comment options

@schungx
Comment options

Answer selected by casey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants