diff src/luan/tools/WebShell.java @ 108:3c404a296995

make Package module more standard; return _ENV by default; add "import" statement; git-svn-id: https://luan-java.googlecode.com/svn/trunk@109 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 23 May 2014 03:21:54 +0000
parents 6ca02b188dba
children 2428ecfed375
line wrap: on
line diff
--- a/src/luan/tools/WebShell.java	Mon May 19 09:17:57 2014 +0000
+++ b/src/luan/tools/WebShell.java	Fri May 23 03:21:54 2014 +0000
@@ -27,13 +27,13 @@
 	protected LuanState newLuanState() throws LuanException {
 		return LuanState.newStandard();
 	}
-
+/*
 	protected LuanTable newEnvironment(LuanState luan) throws LuanException {
 		return luan.newEnvironment();
 	}
-
-	protected Object[] eval(LuanState luan,String cmd,LuanTable env) throws LuanException {
-		return luan.eval(cmd,"WebShell",env);
+*/
+	protected Object[] eval(LuanState luan,String cmd) throws LuanException {
+		return luan.eval(cmd,"WebShell",true);
 	}
 
 	@Override protected void service(HttpServletRequest request,HttpServletResponse response)
@@ -62,15 +62,11 @@
 						luan = newLuanState();
 						session.putValue("luan",luan);
 					}
-					LuanTable env = (LuanTable)session.getValue("env");
-					if( env==null ) {
-						env = newEnvironment(luan);
-						session.putValue("env",env);
-					}
 					luan.out = new PrintStream(history);
+					LuanTable env = luan.global();
 					env.put("request",request);
 					env.put("response",response);
-					Object[] result = eval(luan,cmd,env);
+					Object[] result = eval(luan,cmd);
 					if( result.length > 0 ) {
 						for( int i=0; i<result.length; i++ ) {
 							if( i > 0 )