diff --git a/src/debug/org/luaj/debug/j2se/StandardLuaJVM.java b/src/debug/org/luaj/debug/j2se/StandardLuaJVM.java index c45a1505..b444d678 100644 --- a/src/debug/org/luaj/debug/j2se/StandardLuaJVM.java +++ b/src/debug/org/luaj/debug/j2se/StandardLuaJVM.java @@ -53,7 +53,6 @@ public class StandardLuaJVM { protected boolean bSuspendOnStart = false; protected String script; protected String[] scriptArgs; - protected String luaPath; protected LuaState state; protected boolean isReady = false; protected boolean isTerminated = false; @@ -123,11 +122,6 @@ public class StandardLuaJVM { index++; } - - if (args[index] != null && args[index].startsWith("-L")) { - luaPath = args[index].substring(2); //remove -L fromt the arg - index++; - } String[] scriptArgStrs; if (index != 0) { @@ -184,7 +178,7 @@ public class StandardLuaJVM { } String getLuaPath() { - return this.luaPath; + return System.getProperty("LUA_PATH"); } public void run() { @@ -235,6 +229,7 @@ public class StandardLuaJVM { LuaC.install(); // set the lua path if present + String luaPath = getLuaPath(); if (luaPath != null && luaPath.trim().length() > 0) { PackageLib.setLuaPath(luaPath); } diff --git a/src/debug/org/luaj/debug/net/j2me/ClientConnectionTask.java b/src/debug/org/luaj/debug/net/j2me/ClientConnectionTask.java index e50a6847..a7510692 100644 --- a/src/debug/org/luaj/debug/net/j2me/ClientConnectionTask.java +++ b/src/debug/org/luaj/debug/net/j2me/ClientConnectionTask.java @@ -83,7 +83,8 @@ public class ClientConnectionTask implements Runnable, DebugEventListener { } } catch (EOFException e) { // client has terminated the connection - // it's time to exit. + // it may be time to exit. + handleRequest(new DebugMessage(DebugMessageType.reset)); } catch (IOException e) { e.printStackTrace(); diff --git a/src/test/java/org/luaj/debug/j2se/LuaJVMTest.java b/src/test/java/org/luaj/debug/j2se/LuaJVMTest.java index 47ea84e4..9df6c369 100644 --- a/src/test/java/org/luaj/debug/j2se/LuaJVMTest.java +++ b/src/test/java/org/luaj/debug/j2se/LuaJVMTest.java @@ -218,22 +218,24 @@ public class LuaJVMTest extends TestCase { fail("Should never reach this line."); } - args = new String[] { "-LC:\\lua\\scripts", "dummy.lua" }; + System.setProperty("LUA_PATH", "c:/work/CSI/prototypes/uidemo/?.lua"); + args = new String[] {"dummy.lua" }; vm = new StandardLuaJVM(); try { vm.parse(args); - assertEquals("C:\\lua\\scripts", vm.getLuaPath()); + assertEquals("c:/work/CSI/prototypes/uidemo/?.lua", vm.getLuaPath()); assertEquals("dummy.lua", vm.getScript()); } catch (ParseException e) { fail("Should never reach this line."); } - args = new String[] { "-Dport=1044", "-LC:\\lua\\scripts", "dummy.lua" }; + System.setProperty("LUA_PATH", "c:/work/CSI/prototypes/uidemo/?.lua"); + args = new String[] { "-Dport=1044", "dummy.lua" }; vm = new StandardLuaJVM(); try { vm.parse(args); assertEquals(1044, vm.getDebugPort()); - assertEquals("C:\\lua\\scripts", vm.getLuaPath()); + assertEquals("c:/work/CSI/prototypes/uidemo/?.lua", vm.getLuaPath()); assertEquals("dummy.lua", vm.getScript()); } catch (ParseException e) { fail("Should never reach this line.");