Mercurial Hosting > luan
diff src/luan/tools/web_run.luan @ 157:1de3e4a6e82d
remove LuanJavaFunction.RTN_NUMBER_ARRAY;
add request.java and response.java;
convert java Object[] members to List;
let LuanState.eval() take env;
improve web_run.luan;
rename LuanParser.JspExpressions to TemplateExpressions and add TemplateStmt;
git-svn-id: https://luan-java.googlecode.com/svn/trunk@158 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Wed, 18 Jun 2014 21:07:11 +0000 |
parents | 925ba2d59b9d |
children |
line wrap: on
line diff
--- a/src/luan/tools/web_run.luan Wed Jun 18 08:16:50 2014 +0000 +++ b/src/luan/tools/web_run.luan Wed Jun 18 21:07:11 2014 +0000 @@ -17,17 +17,21 @@ end function page() + local content_type = Http.request.get_parameter("content_type") + if content_type ~= nil then + Http.response.set_content_type(content_type) + end 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>",env) - fn() + local run = load(code,"<web_run>",env) + run() catch e do + Http.response.set_content_type "text/plain" print(e) print() print()