Mercurial Hosting > luan
view core/src/luan/modules/Debug.luan @ 300:9fb523472035
add java() to control java access
git-svn-id: https://luan-java.googlecode.com/svn/trunk@301 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 16 Dec 2014 13:13:33 +0000 |
parents | 2ce23c7e2342 |
children | 7f7708e8fdd4 |
line wrap: on
line source
import "luan:Table" import "luan:Io" function print_if_something(...) if Table.pack(...).n > 0 then print(...) end end function debug(prompt) prompt = prompt or "luan_debug> " local function console() return Io.read_console_line(prompt) end local env = {} for line in console do try local fn = load(line,"stdin",env,true) print_if_something( fn() ) catch e do print(e) end end end