Add -n option to launch without debug library.

This commit is contained in:
James Roseborough
2010-09-03 20:34:32 +00:00
parent 77777a9dd8
commit aa572abd65

View File

@@ -52,6 +52,7 @@ public class lua {
" -v show version information\n" + " -v show version information\n" +
" -j use lua2java source-to-source compiler\n" + " -j use lua2java source-to-source compiler\n" +
" -b use luajc bytecode-to-bytecode compiler (requires bcel on class path)\n" + " -b use luajc bytecode-to-bytecode compiler (requires bcel on class path)\n" +
" -n nodebug - do not load debug library by default\n" +
" -- stop handling options\n" + " -- stop handling options\n" +
" - execute stdin and stop handling options"; " - execute stdin and stop handling options";
@@ -64,13 +65,11 @@ public class lua {
public static void main( String[] args ) throws IOException { public static void main( String[] args ) throws IOException {
// new lua state
_G = JsePlatform.debugGlobals();
// process args // process args
boolean interactive = (args.length == 0); boolean interactive = (args.length == 0);
boolean versioninfo = false; boolean versioninfo = false;
boolean processing = true; boolean processing = true;
boolean nodebug = false;
try { try {
// stateful argument processing // stateful argument processing
for ( int i=0; i<args.length; i++ ) { for ( int i=0; i<args.length; i++ ) {
@@ -104,6 +103,9 @@ public class lua {
case 'v': case 'v':
versioninfo = true; versioninfo = true;
break; break;
case 'n':
nodebug = true;
break;
case '-': case '-':
if ( args[i].length() > 2 ) if ( args[i].length() > 2 )
usageExit(); usageExit();
@@ -116,6 +118,9 @@ public class lua {
} }
} }
// new lua state
_G = nodebug? JsePlatform.standardGlobals(): JsePlatform.debugGlobals();
// echo version // echo version
if ( versioninfo ) if ( versioninfo )
System.out.println(version); System.out.println(version);