Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Razov

Member Since 07 Sep 2012
Offline Last Active Private

Topics I've Started

Stoping the execution of lua script in LuaInterface

07 September 2012 - 01:57 PM

Hello,

lets say that i have got such code:

String script = @"
writeConsole("Starting.")
while true do
  writeConsole("I am alive...")
  sleep(1000)
end";
Lua lua = new Lua();
lua.DoString(script);

witch after executed in new thread keeps writing "I am alive..." evry second, like:


Starting.
I am alive...
I am alive...
I am alive...
.....

Is there any way to stop executing this loop (or any other lua script witch is in middle of execution at given point) from other thread ? And to reload execution of this script, so it will give output like this:

Starting.
I am alive...
I am alive...
I am alive...
Starting. // stop execution and start again in this place
I am alive...
I am alive...

PARTNERS