Terminate Lua Thread without Terminating JVM
Brought to you by:
ian_farmer,
jim_roseborough
Is it possible to introduce an alternative to os.exit() that terminates the calling Lua thread but not the JVM? There is currently no way of interrupting a running Lua script without terminating the JVM; something which is rather inconvenient.
Quick demonstration:
// badscript.lua contains "while true do end"
Thread t = new Thread() {
public void run() {
JsePlatform.standardGlobals().loadFile("badscript.lua").call();
}
};
t.start();
t.stop(); // does not interrupt the Lua script
If this can't be patched, can anyone recommend an alternative?