It was very easy to get it loading a script and running it within the game, so far so good.
Next stage is, instead of running an entire script at once (via lua_pcall), I want to be able to run through a script, up until it reaches certain time consuming functions, when I want to pause the script until the c++ tells it to resume again.
Here's the flow:
TextOut("Hello I am a monster") Wait(5) TextOut("Now I'm going to eat you") Wait(2) MoveToPlayer() TextOut("Yum yum")
So within most scripts run by characters etc, I need to pause the script, get on with running the rest of the game, other scripts etc, then resume again when the wait condition is satisfied.
The example above has 2 'waiting' functions, Wait (number of seconds), and MoveToPlayer (which may take a varying amount of time).
Hopefully this should make sense.
Does anyone have any idea how I should achieve this in lua? I'm having inkling feelings it may be to do with the yield and resume commands, but I haven't seen any decent explanations.