Mercurial Hosting > luan
view src/luan/lib/init.luan @ 133:98aba462c422
add tools/cmd_line.luan
git-svn-id: https://luan-java.googlecode.com/svn/trunk@134 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Wed, 11 Jun 2014 05:20:19 +0000 |
parents | f0a4abe58593 |
children | 3b384dc5ca91 |
line wrap: on
line source
--Io.stdout.write "this is init.luan\n" local function print(...) local list = {} for _,v in Basic.values(...) do list[#list+1] = to_string(v) list[#list+1] = '\t' end if #list == 0 then Io.stdout.write( '\n' ) else list[#list] = '\n' Io.stdout.write( Table.unpack(list) ) end end _G.print = print local Debug = {} Package.loaded.Debug = Debug _G.Debug = Debug 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) local result = Table.pack( fn() ) if result.n > 0 then print( Table.unpack(result,1,result.n) ) end catch e do print(e) end end end