changeset 156:925ba2d59b9d

fix String java calls; improve web_run.luan; git-svn-id: https://luan-java.googlecode.com/svn/trunk@157 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Wed, 18 Jun 2014 08:16:50 +0000
parents db7b3902e01c
children 1de3e4a6e82d
files src/luan/lib/StringLib.java src/luan/tools/web_run.luan
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/lib/StringLib.java	Wed Jun 18 07:38:46 2014 +0000
+++ b/src/luan/lib/StringLib.java	Wed Jun 18 08:16:50 2014 +0000
@@ -75,7 +75,7 @@
 				};
 			}
 		}
-		if( luan.global().get("Java") != null )
+		if( luan.loaded().get("Java") != null )
 			return JavaLib.__index(luan,s,key);
 		return null;
 	}
--- a/src/luan/tools/web_run.luan	Wed Jun 18 07:38:46 2014 +0000
+++ b/src/luan/tools/web_run.luan	Wed Jun 18 08:16:50 2014 +0000
@@ -17,11 +17,15 @@
 end
 
 function page()
-	Http.response.set_content_type "text/plain"
 	Io.stdout = Http.response.text_writer()
 	local code = Http.request.get_parameter "code"
+	local env = {
+		write = Io.stdout.write;
+		request = Http.request;
+		response = Http.response;
+	}
 	try
-		local fn = load(code,"<web_run>")
+		local fn = load(code,"<web_run>",env)
 		fn()
 	catch e do
 		print(e)