Mercurial Hosting > luan
view src/luan/lib/init.luan @ 139:3b384dc5ca91
replace WebShell.java with web_shell.luan
git-svn-id: https://luan-java.googlecode.com/svn/trunk@140 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 13 Jun 2014 12:26:44 +0000 |
parents | 98aba462c422 |
children | c2ee8a717b73 |
line wrap: on
line source
--Io.stdout.write "this is init.luan\n" function Io.print_to(out,...) local list = {} for _,v in Basic.values(...) do list[#list+1] = to_string(v) list[#list+1] = '\t' end if #list == 0 then out.write( '\n' ) else list[#list] = '\n' out.write( Table.unpack(list) ) end end function _G.print(...) Io.print_to(Io.stdout,...) end local Debug = {} Package.loaded.Debug = Debug _G.Debug = Debug function Debug.print_if_something(...) if Table.pack(...).n > 0 then _G.print(...) end end function Debug.debug(prompt) prompt = prompt or "luan_debug> " local function console() return Io.read_console_line(prompt) end for line in console do try local fn = load(line,"stdin",true,true) Debug.print_if_something( fn() ) catch e do print(e) end end end