Mercurial Hosting > luan
view core/src/luan/modules/Debug.luan @ 359:8848edb0e6bf
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 15 Apr 2015 08:58:54 -0600 |
parents | db37d6aee4db |
children | 92c3d22745b8 |
line wrap: on
line source
local Luan = require "luan:Luan" local load = Luan.load local try = Luan.try local Io = require "luan:Io" local print = Io.print local Table = require "luan:Table" 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 { function() local fn = load(line,"stdin",env,true) print_if_something( fn() ) end; catch = function(e) print(e) end; } end end