Sign in to follow this  

Halting a lua script

Recommended Posts

I'm trying to integrate Lua into my game to run the cutscenes and some level setup, and I need to be able to halt and breakout of the script in order to run game logic and rendering.


WaitForNPC() <- Wait for the game to get NPC into position, so break out and let the logic/rendering run.


This is a simple example, but in other cases I need to make sure the script doesn't get out of sync with the rendering or other bits of game logic.
I'm only new to Lua and don't know the best way to get the VM to do this, or if it's even possible.

Share this post

Link to post
Share on other sites
You'd have to look into lua couroutines to get the behavior you wanted. Essentially; you'd coroutine.yield() until a condition was true; and then continue with the script.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this