Mercurial Hosting > luan
comparison web/src/luan/modules/web/web_shell.luan @ 326:db37d6aee4db
remove try-catch statement;
add Luan.try() and Luan.pcall();
git-svn-id: https://luan-java.googlecode.com/svn/trunk@327 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 19 Mar 2015 00:01:57 +0000 |
parents | 78a6a71afbfd |
children | fb18724521d2 |
comparison
equal
deleted
inserted
replaced
325:78a6a71afbfd | 326:db37d6aee4db |
---|---|
1 local Luan = require "luan:Luan" | 1 local Luan = require "luan:Luan" |
2 local ipairs = Luan.ipairs | 2 local ipairs = Luan.ipairs |
3 local load = Luan.load | 3 local load = Luan.load |
4 local try = Luan.try | |
4 local Io = require "luan:Io" | 5 local Io = require "luan:Io" |
5 local print = Io.print | 6 local print = Io.print |
6 local Debug = require "luan:Debug" | 7 local Debug = require "luan:Debug" |
7 local Http = require "luan:web/Http" | 8 local Http = require "luan:web/Http" |
8 local Html = require "luan:Html" | 9 local Html = require "luan:Html" |
23 for _,v in Luan.values(...) do | 24 for _,v in Luan.values(...) do |
24 history[#history+1] = v | 25 history[#history+1] = v |
25 end | 26 end |
26 end | 27 end |
27 print( "% "..cmd ) | 28 print( "% "..cmd ) |
28 try | 29 try { |
29 local line = load(cmd,"<web_shell>",env,true) | 30 function() |
30 Debug.print_if_something( line() ) | 31 local line = load(cmd,"<web_shell>",env,true) |
31 catch e do | 32 Debug.print_if_something( line() ) |
32 Io.print_to(Io.stderr,e) | 33 end; |
33 print(e) | 34 catch = function(e) |
34 end | 35 Io.print_to(Io.stderr,e) |
36 print(e) | |
37 end; | |
38 } | |
35 end | 39 end |
36 end | 40 end |
37 | 41 |
38 Io.stdout = Http.response.text_writer() | 42 Io.stdout = Http.response.text_writer() |
39 Html.simple_html_page{ | 43 Html.simple_html_page{ |