Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 07 Sep 2012
Offline Last Active Private

Posts I've Made

In Topic: Stoping the execution of lua script in LuaInterface

17 September 2012 - 12:59 PM

Thats not the point.

I am using LuaInterface for C#.

I am creating an application, where user can write his own lua code and execute it (new thread). I want to have possiblity to stop (interput) the execution of this lua code from C#. Lets see an example:

Lets say there is such application:

Posted Image

When You change "Enabled" CheckBox Checked to true, lua executes onEnabled function (this part is already done.), witch starts loop
When You change "Enabled" CheckBox Checked to false, execution of lua (there is loop running) is terminated/stoped, but lua variables stays untoutched (not cleaned)
When You press "RELOAD" button, execution of lua is stopped (if its running), then lua enverionment is cleared, and lua code from textbox is executed, so user can make changes to it and press reload.

Example output it would give:

["Enabled" Checked=true]
eC: 1 / wC: 1
eC: 1 / wC: 2
eC: 1 / wC: 3
["Enabled" Checked=false]
[time passes, nothing appears on log...]
["Enabled" Checked=true]
eC: 2 / wC: 4
eC: 2 / wC: 5
[RELOAD pressed]
eC: 1 / wC: 1
eC: 1 / wC: 2

The main problem i am facing right now is how i can stop execution of running lua code from c#?