Mercurial Hosting > luan
changeset 130:0594c132888b
cleanup
git-svn-id: https://luan-java.googlecode.com/svn/trunk@131 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 10 Jun 2014 02:43:40 +0000 |
parents | 486a0641bca4 |
children | 15a8e6588f3c |
files | src/luan/LuanBit.java src/luan/LuanJavaFunction.java src/luan/LuanState.java src/luan/interp/ForStmt.java src/luan/lib/BasicLib.java src/luan/lib/HttpLib.java src/luan/lib/IoLib.java src/luan/lib/JavaLib.java src/luan/lib/PackageLib.java src/luan/lib/PickleClient.java src/luan/lib/PickleCon.java src/luan/lib/StringLib.java src/luan/lib/TableLib.java src/luan/lib/ThreadLib.java src/luan/lib/Utils.java src/luan/tools/CmdLine.java src/luan/tools/WebRun.java src/luan/tools/WebShell.java |
diffstat | 18 files changed, 104 insertions(+), 83 deletions(-) [+] |
line wrap: on
line diff
diff -r 486a0641bca4 -r 0594c132888b src/luan/LuanBit.java --- a/src/luan/LuanBit.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/LuanBit.java Tue Jun 10 02:43:40 2014 +0000 @@ -16,10 +16,6 @@ return new LuanException(this,msg); } - public Object call(LuanFunction fn,String fnName) throws LuanException { - return call(fn,fnName,LuanFunction.NOTHING); - } - public Object call(LuanFunction fn,String fnName,Object[] args) throws LuanException { List<StackTraceElement> stackTrace = luan.stackTrace; stackTrace.add( new StackTraceElement(el,fnName) );
diff -r 486a0641bca4 -r 0594c132888b src/luan/LuanJavaFunction.java --- a/src/luan/LuanJavaFunction.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/LuanJavaFunction.java Tue Jun 10 02:43:40 2014 +0000 @@ -76,7 +76,7 @@ throw (Error)cause; if( cause instanceof LuanException ) throw (LuanException)cause; - throw luan.JAVA.exception(cause); + throw luan.exception(cause); } catch(InstantiationException e) { throw new RuntimeException(e); } @@ -109,10 +109,10 @@ String expected = paramType.getSimpleName(); if( arg==null ) { if( paramType.isPrimitive() ) - throw luan.JAVA.exception("bad argument #"+(i+1-start)+" ("+expected+" expected, got nil)"); + throw luan.exception("bad argument #"+(i+1-start)+" ("+expected+" expected, got nil)"); } else { String got = arg.getClass().getSimpleName(); - throw luan.JAVA.exception("bad argument #"+(i+1-start)+" ("+expected+" expected, got "+got+")"); + throw luan.exception("bad argument #"+(i+1-start)+" ("+expected+" expected, got "+got+")"); } } }
diff -r 486a0641bca4 -r 0594c132888b src/luan/LuanState.java --- a/src/luan/LuanState.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/LuanState.java Tue Jun 10 02:43:40 2014 +0000 @@ -20,7 +20,45 @@ public abstract class LuanState implements DeepCloneable<LuanState> { - public final LuanBit JAVA = bit(LuanElement.JAVA); + private final LuanBit JAVA = bit(LuanElement.JAVA); + + public LuanException exception(Object msg) { + return JAVA.exception(msg); + } + + public Object call(LuanFunction fn) throws LuanException { + return call(fn,null,LuanFunction.NOTHING); + } + + public Object call(LuanFunction fn,String fnName) throws LuanException { + return call(fn,fnName,LuanFunction.NOTHING); + } + + public Object call(LuanFunction fn,Object[] args) throws LuanException { + return call(fn,null,args); + } + + public Object call(LuanFunction fn,String fnName,Object[] args) throws LuanException { + return JAVA.call(fn,fnName,args); + } + + public LuanFunction checkFunction(Object obj) throws LuanException { + return JAVA.checkFunction(obj); + } + + public String toString(Object obj) throws LuanException { + return JAVA.toString(obj); + } + + public String repr(Object obj) throws LuanException { + return JAVA.repr(obj); + } + + public boolean isLessThan(Object o1,Object o2) throws LuanException { + return JAVA.isLessThan(o1,o2); + } + + private LuanTable global; private LuanTable loaded; @@ -120,9 +158,9 @@ } } - public final Object eval(String cmd,String sourceName,boolean allowExpr) throws LuanException { - LuanFunction fn = BasicLib.load(this,cmd,sourceName,true,allowExpr); - return JAVA.call(fn,null); + public final Object eval(String cmd) throws LuanException { + LuanFunction fn = BasicLib.load(this,cmd,"eval",true,true); + return call(fn); }
diff -r 486a0641bca4 -r 0594c132888b src/luan/interp/ForStmt.java --- a/src/luan/interp/ForStmt.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/interp/ForStmt.java Tue Jun 10 02:43:40 2014 +0000 @@ -27,7 +27,7 @@ String name = iterExpr.se().text(); try { while(true) { - Object vals = bit.call(iter,name); + Object vals = bit.call(iter,name,LuanFunction.NOTHING); if( vals==null ) break; if( vals instanceof Object[] ) {
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/BasicLib.java --- a/src/luan/lib/BasicLib.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/BasicLib.java Tue Jun 10 02:43:40 2014 +0000 @@ -43,7 +43,6 @@ add( global, "load", LuanState.class, String.class, String.class, Boolean.class, Boolean.class ); add( global, "load_file", LuanState.class, String.class ); add( global, "pairs", LuanState.class, LuanTable.class ); -// add( global, "print", LuanState.class, new Object[0].getClass() ); add( global, "range", LuanState.class, Double.TYPE, Double.TYPE, Double.class ); add( global, "raw_equal", Object.class, Object.class ); add( global, "raw_get", LuanTable.class, Object.class ); @@ -66,19 +65,7 @@ private static void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException { t.put( method, new LuanJavaFunction(BasicLib.class.getMethod(method,parameterTypes),null) ); } -/* - public static void print(LuanState luan,Object... args) throws LuanException { - LuanFunction write = (LuanFunction)luan.get("Io.stdout.write"); - List<Object> list = new ArrayList<Object>(); - for( int i=0; i<args.length; i++ ) { - if( i > 0 ) - list.add("\t"); - list.add(args[i]); - } - list.add("\n"); - write.call(luan,list.toArray()); - } -*/ + public static String type(Object obj) { return Luan.type(obj); } @@ -99,7 +86,7 @@ String src = fileName==null ? Utils.readAll(new InputStreamReader(System.in)) : new IoLib.LuanFile(fileName).read_text(); return load(luan,src,fileName,false,false); } catch(IOException e) { - throw luan.JAVA.exception(e); + throw luan.exception(e); } } @@ -108,18 +95,18 @@ String src = new IoLib.LuanUrl(IoLib.java_resource_to_url(path)).read_text(); return load(luan,src,path,false,false); } catch(IOException e) { - throw luan.JAVA.exception(e); + throw luan.exception(e); } } public static Object do_file(LuanState luan,String fileName) throws LuanException { LuanFunction fn = load_file(luan,fileName); - return luan.JAVA.call(fn,null); + return luan.call(fn); } public static Object do_java_resource(LuanState luan,String path) throws LuanException { LuanFunction fn = load_java_resource(luan,path); - return luan.JAVA.call(fn,null); + return luan.call(fn); } private static LuanFunction pairs(final Iterator<Map.Entry<Object,Object>> iter) { @@ -174,7 +161,7 @@ LuanTable t = (LuanTable)v; return t.length(); } - throw luan.JAVA.exception( "bad argument #1 to 'raw_len' (table or string expected)" ); + throw luan.exception( "bad argument #1 to 'raw_len' (table or string expected)" ); } public static Number to_number(Object e,Integer base) { @@ -182,11 +169,11 @@ } public static String to_string(LuanState luan,Object v) throws LuanException { - return luan.JAVA.toString(v); + return luan.toString(v); } public static void error(LuanState luan,Object msg) throws LuanException { - throw luan.JAVA.exception(msg); + throw luan.exception(msg); } public static Object assert_(LuanState luan,Object v,String msg) throws LuanException { @@ -194,7 +181,7 @@ return v; if( msg == null ) msg = "assertion failed!"; - throw luan.JAVA.exception( msg ); + throw luan.exception( msg ); } public static String assert_string(LuanState luan,String v) throws LuanException { @@ -218,18 +205,18 @@ public static Object assert_nil(LuanState luan,Object v) throws LuanException { if( v != null ) - throw luan.JAVA.exception("bad argument #1 (nil expected, got "+Luan.type(v)+")"); + throw luan.exception("bad argument #1 (nil expected, got "+Luan.type(v)+")"); return v; } public static String repr(LuanState luan,Object v) throws LuanException { - return luan.JAVA.repr(v); + return luan.repr(v); } public static LuanFunction range(LuanState luan,final double from,final double to,Double stepV) throws LuanException { final double step = stepV==null ? 1.0 : stepV; if( step == 0.0 ) - throw luan.JAVA.exception("bad argument #3 (step may not be zero)"); + throw luan.exception("bad argument #3 (step may not be zero)"); return new LuanFunction() { double v = from;
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/HttpLib.java --- a/src/luan/lib/HttpLib.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/HttpLib.java Tue Jun 10 02:43:40 2014 +0000 @@ -28,7 +28,7 @@ PackageLib.require(luan,NAME); Object fn = luan.get(HttpLib.FN_NAME); if( !(fn instanceof LuanFunction) ) - throw luan.JAVA.exception( "function '"+HttpLib.FN_NAME+"' not defined" ); + throw luan.exception( "function '"+HttpLib.FN_NAME+"' not defined" ); } public static void service(LuanState luan,HttpServletRequest request,HttpServletResponse response) @@ -46,7 +46,7 @@ throw new RuntimeException(e); } - luan.JAVA.call(fn,FN_NAME); + luan.call(fn,FN_NAME); } private final HttpServletRequest request;
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/IoLib.java --- a/src/luan/lib/IoLib.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/IoLib.java Tue Jun 10 02:43:40 2014 +0000 @@ -121,7 +121,7 @@ public void write(LuanState luan,Object... args) throws LuanException { for( Object obj : args ) { - out.print( luan.JAVA.toString(obj) ); + out.print( luan.toString(obj) ); } } @@ -137,7 +137,7 @@ public void write(LuanState luan,Object... args) throws LuanException, IOException { for( Object obj : args ) { - out.write( luan.JAVA.toString(obj) ); + out.write( luan.toString(obj) ); } } @@ -185,7 +185,7 @@ try { if( args.length > 0 ) { if( args.length > 1 || !"close".equals(args[0]) ) - throw luan.JAVA.exception( "the only argument allowed is 'close'" ); + throw luan.exception( "the only argument allowed is 'close'" ); in.close(); return null; } @@ -194,7 +194,7 @@ in.close(); return rtn; } catch(IOException e) { - throw luan.JAVA.exception(e); + throw luan.exception(e); } } }; @@ -208,7 +208,7 @@ try { if( args.length > 0 ) { if( args.length > 1 || !"close".equals(args[0]) ) - throw luan.JAVA.exception( "the only argument allowed is 'close'" ); + throw luan.exception( "the only argument allowed is 'close'" ); in.close(); return null; } @@ -218,7 +218,7 @@ } return a; } catch(IOException e) { - throw luan.JAVA.exception(e); + throw luan.exception(e); } } }; @@ -292,7 +292,7 @@ out.close(); return; } - throw luan.JAVA.exception( "bad argument #1 to 'write' (string or binary expected)" ); + throw luan.exception( "bad argument #1 to 'write' (string or binary expected)" ); } public LuanTable text_writer() throws IOException { @@ -416,13 +416,13 @@ try { if( args.length > 0 ) { if( args.length > 1 || !"close".equals(args[0]) ) - throw luan.JAVA.exception( "the only argument allowed is 'close'" ); + throw luan.exception( "the only argument allowed is 'close'" ); ss.close(); return null; } return new LuanSocket(ss.accept()).table(); } catch(IOException e) { - throw luan.JAVA.exception(e); + throw luan.exception(e); } } };
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/JavaLib.java --- a/src/luan/lib/JavaLib.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/JavaLib.java Tue Jun 10 02:43:40 2014 +0000 @@ -114,7 +114,7 @@ } } } - throw luan.JAVA.exception("invalid member '"+key+"' for: "+obj); + throw luan.exception("invalid member '"+key+"' for: "+obj); } Class cls = obj.getClass(); if( cls.isArray() ) { @@ -125,7 +125,7 @@ if( i != null ) { return Array.get(obj,i); } - throw luan.JAVA.exception("invalid member '"+key+"' for java array: "+obj); + throw luan.exception("invalid member '"+key+"' for java array: "+obj); } if( key instanceof String ) { String name = (String)key; @@ -138,7 +138,7 @@ } } } -// throw luan.JAVA.exception("invalid member '"+key+"' for java object: "+obj); +// throw luan.exception("invalid member '"+key+"' for java object: "+obj); return null; } @@ -182,7 +182,7 @@ return; } } - throw luan.JAVA.exception("invalid member '"+key+"' for: "+obj); + throw luan.exception("invalid member '"+key+"' for: "+obj); } Class cls = obj.getClass(); if( cls.isArray() ) { @@ -191,7 +191,7 @@ Array.set(obj,i,value); return; } - throw luan.JAVA.exception("invalid member '"+key+"' for java array: "+obj); + throw luan.exception("invalid member '"+key+"' for java array: "+obj); } if( key instanceof String ) { String name = (String)key; @@ -203,7 +203,7 @@ return; } } - throw luan.JAVA.exception("invalid member '"+key+"' for java object: "+obj); + throw luan.exception("invalid member '"+key+"' for java object: "+obj); } private static void setMember(Object obj,List<Member> members,Object value) { @@ -377,7 +377,7 @@ return fn.rawCall(luan,args); } catch(IllegalArgumentException e) {} } - throw luan.JAVA.exception("no method matched args"); + throw luan.exception("no method matched args"); } } @@ -414,7 +414,7 @@ if( !cls.isInstance(v) ) { String got = v.getClass().getSimpleName(); String expected = cls.getSimpleName(); - throw luan.JAVA.exception("bad argument #1 ("+expected+" expected, got "+got+")"); + throw luan.exception("bad argument #1 ("+expected+" expected, got "+got+")"); } return v; } @@ -444,8 +444,8 @@ Object fnObj = t.get(name); if( fnObj==null && base!=null ) return method.invoke(base,args); - LuanFunction fn = luan.JAVA.checkFunction(fnObj); - return Luan.first(luan.JAVA.call(fn,name,args)); + LuanFunction fn = luan.checkFunction(fnObj); + return Luan.first(luan.call(fn,name,args)); } } );
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/PackageLib.java --- a/src/luan/lib/PackageLib.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/PackageLib.java Tue Jun 10 02:43:40 2014 +0000 @@ -55,11 +55,11 @@ searchers = new LuanTable(Collections.<Object>singletonList(preloadSearcher)); for( Object s : searchers.asList() ) { LuanFunction searcher = (LuanFunction)s; - Object[] a = Luan.array(luan.JAVA.call(searcher,"<searcher>",new Object[]{modName})); + Object[] a = Luan.array(luan.call(searcher,"<searcher>",new Object[]{modName})); if( a.length >= 1 && a[0] instanceof LuanFunction ) { LuanFunction loader = (LuanFunction)a[0]; a[0] = modName; - mod = Luan.first(luan.JAVA.call(loader,"<require \""+modName+"\">",a)); + mod = Luan.first(luan.call(loader,"<require \""+modName+"\">",a)); if( mod != null ) { loaded.put(modName,mod); } else { @@ -71,7 +71,7 @@ } } if( mod == null ) - throw luan.JAVA.exception( "module '"+modName+"' not found" ); + throw luan.exception( "module '"+modName+"' not found" ); } return mod; } @@ -122,7 +122,7 @@ LuanFunction fn = BasicLib.load(luan,src,urlStr,false,false); return fn.call(luan,args); } catch(IOException e) { - throw luan.JAVA.exception(e); + throw luan.exception(e); } } };
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/PickleClient.java --- a/src/luan/lib/PickleClient.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/PickleClient.java Tue Jun 10 02:43:40 2014 +0000 @@ -29,7 +29,7 @@ } else { String msg = (String)result[1]; String src = (String)result[2]; - throw con.luan.JAVA.exception( + throw con.luan.exception( msg + "\n" + "in:\n" + "------------------\n"
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/PickleCon.java --- a/src/luan/lib/PickleCon.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/PickleCon.java Tue Jun 10 02:43:40 2014 +0000 @@ -49,7 +49,7 @@ while( i < size ) { int n = in.read(a,i,size-i); if( n == -1 ) - throw luan.JAVA.exception( "end of stream" ); + throw luan.exception( "end of stream" ); i += n; } return a; @@ -59,7 +59,7 @@ ioModule.put("_read_binary",_read_binary); src = in.readUTF(); LuanFunction fn = BasicLib.load(luan,src,"pickle-reader",true,false); - Object rtn = luan.JAVA.call(fn,null); + Object rtn = luan.call(fn); ioModule.put("_binaries",null); return rtn; } @@ -78,7 +78,7 @@ binaries.add(a); return "Io._binaries[" + binaries.size() + "]"; } - throw luan.JAVA.exception( "invalid type: " + obj.getClass() ); + throw luan.exception( "invalid type: " + obj.getClass() ); } private String pickle(Object obj,Set<LuanTable> set) throws LuanException { @@ -87,7 +87,7 @@ private String pickle(LuanTable tbl,Set<LuanTable> set) throws LuanException { if( !set.add(tbl) ) { - throw luan.JAVA.exception( "circular reference in table" ); + throw luan.exception( "circular reference in table" ); } StringBuilder sb = new StringBuilder(); sb.append( "{" ); @@ -111,7 +111,7 @@ } } for( Object obj : args ) { - sb.append( luan.JAVA.toString(obj) ); + sb.append( luan.toString(obj) ); } out.writeUTF( sb.toString() ); for( byte[] a : binaries ) {
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/StringLib.java --- a/src/luan/lib/StringLib.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/StringLib.java Tue Jun 10 02:43:40 2014 +0000 @@ -222,7 +222,7 @@ if( Luan.toBoolean(val) ) { String replacement = Luan.asString(val); if( replacement==null ) - throw luan.JAVA.exception( "invalid replacement value (a "+Luan.type(val)+")" ); + throw luan.exception( "invalid replacement value (a "+Luan.type(val)+")" ); m.appendReplacement(sb,replacement); } i++; @@ -245,11 +245,11 @@ args[j] = m.group(j); } } - Object val = Luan.first( luan.JAVA.call(fn,"repl-arg",args) ); + Object val = Luan.first( luan.call(fn,"repl-arg",args) ); if( Luan.toBoolean(val) ) { String replacement = Luan.asString(val); if( replacement==null ) - throw luan.JAVA.exception( "invalid replacement value (a "+Luan.type(val)+")" ); + throw luan.exception( "invalid replacement value (a "+Luan.type(val)+")" ); m.appendReplacement(sb,replacement); } i++; @@ -257,7 +257,7 @@ m.appendTail(sb); return new Object[]{ sb.toString(), i }; } - throw luan.JAVA.exception( "bad argument #3 to 'gsub' (string/function/table expected)" ); + throw luan.exception( "bad argument #3 to 'gsub' (string/function/table expected)" ); } // note - String.format() is too stupid to convert between ints and floats.
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/TableLib.java --- a/src/luan/lib/TableLib.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/TableLib.java Tue Jun 10 02:43:40 2014 +0000 @@ -54,7 +54,7 @@ buf.append(sep); String s = Luan.asString(val); if( s==null ) - throw luan.JAVA.exception( "invalid value ("+Luan.type(val)+") at index "+k+" in table for 'concat'" ); + throw luan.exception( "invalid value ("+Luan.type(val)+") at index "+k+" in table for 'concat'" ); buf.append(val); } return buf.toString(); @@ -64,7 +64,7 @@ try { list.insert(pos,value); } catch(IndexOutOfBoundsException e) { - throw luan.JAVA.exception(e); + throw luan.exception(e); } } @@ -72,7 +72,7 @@ try { return list.remove(pos); } catch(IndexOutOfBoundsException e) { - throw luan.JAVA.exception(e); + throw luan.exception(e); } } @@ -86,7 +86,7 @@ lt = new LessThan() { public boolean isLessThan(Object o1,Object o2) { try { - return luan.JAVA.isLessThan(o1,o2); + return luan.isLessThan(o1,o2); } catch(LuanException e) { throw new LuanRuntimeException(e); } @@ -96,7 +96,7 @@ lt = new LessThan() { public boolean isLessThan(Object o1,Object o2) { try { - return Luan.toBoolean(Luan.first(luan.JAVA.call(comp,"comp-arg",new Object[]{o1,o2}))); + return Luan.toBoolean(Luan.first(luan.call(comp,"comp-arg",new Object[]{o1,o2}))); } catch(LuanException e) { throw new LuanRuntimeException(e); }
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/ThreadLib.java --- a/src/luan/lib/ThreadLib.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/ThreadLib.java Tue Jun 10 02:43:40 2014 +0000 @@ -41,7 +41,7 @@ final Object[] newArgs = cloner.deepClone(args); exec.execute(new Runnable(){public void run() { try { - newLuan.JAVA.call(newFn,"<forked>",newArgs); + newLuan.call(newFn,"<forked>",newArgs); } catch(LuanException e) { e.printStackTrace(); }
diff -r 486a0641bca4 -r 0594c132888b src/luan/lib/Utils.java --- a/src/luan/lib/Utils.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/lib/Utils.java Tue Jun 10 02:43:40 2014 +0000 @@ -16,7 +16,7 @@ public static void checkNotNull(LuanState luan,Object v,String expected) throws LuanException { if( v == null ) - throw luan.JAVA.exception("bad argument #1 ("+expected+" expected, got nil)"); + throw luan.exception("bad argument #1 ("+expected+" expected, got nil)"); } public static String readAll(Reader in)
diff -r 486a0641bca4 -r 0594c132888b src/luan/tools/CmdLine.java --- a/src/luan/tools/CmdLine.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/tools/CmdLine.java Tue Jun 10 02:43:40 2014 +0000 @@ -16,7 +16,7 @@ LuanState luan = LuanState.newStandard(); try { LuanFunction standalone = (LuanFunction)luan.get("Basic.standalone"); - luan.JAVA.call(standalone,"standalone",args); + luan.call(standalone,args); } catch(LuanException e) { // System.err.println(e.getMessage()); e.printStackTrace();
diff -r 486a0641bca4 -r 0594c132888b src/luan/tools/WebRun.java --- a/src/luan/tools/WebRun.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/tools/WebRun.java Tue Jun 10 02:43:40 2014 +0000 @@ -38,7 +38,7 @@ LuanTable env = luan.global(); env.put("request",request); env.put("response",response); - luan.eval(code,"WebRun",false); + luan.eval(code); } catch(LuanException e) { logger.error(null,e); response.reset();
diff -r 486a0641bca4 -r 0594c132888b src/luan/tools/WebShell.java --- a/src/luan/tools/WebShell.java Mon Jun 09 09:16:16 2014 +0000 +++ b/src/luan/tools/WebShell.java Tue Jun 10 02:43:40 2014 +0000 @@ -31,7 +31,7 @@ } protected Object[] eval(LuanState luan,String cmd) throws LuanException { - return Luan.array(luan.eval(cmd,"WebShell",true)); + return Luan.array(luan.eval(cmd)); } @Override protected void service(HttpServletRequest request,HttpServletResponse response) @@ -69,7 +69,7 @@ for( int i=0; i<result.length; i++ ) { if( i > 0 ) writer.write(" "); - writer.write(HtmlLib.encode(luan.JAVA.toString(result[i]))); + writer.write(HtmlLib.encode(luan.toString(result[i]))); } writer.write("\r\n"); }