Mercurial Hosting > luan
diff 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 |
line wrap: on
line diff
--- a/web/src/luan/modules/web/web_shell.luan Tue Mar 03 06:00:59 2015 +0000 +++ b/web/src/luan/modules/web/web_shell.luan Thu Mar 19 00:01:57 2015 +0000 @@ -1,6 +1,7 @@ local Luan = require "luan:Luan" local ipairs = Luan.ipairs local load = Luan.load +local try = Luan.try local Io = require "luan:Io" local print = Io.print local Debug = require "luan:Debug" @@ -25,13 +26,16 @@ end end print( "% "..cmd ) - try - local line = load(cmd,"<web_shell>",env,true) - Debug.print_if_something( line() ) - catch e do - Io.print_to(Io.stderr,e) - print(e) - end + try { + function() + local line = load(cmd,"<web_shell>",env,true) + Debug.print_if_something( line() ) + end; + catch = function(e) + Io.print_to(Io.stderr,e) + print(e) + end; + } end end