diff --git a/daemon/lua/sandbox.lua.in b/daemon/lua/sandbox.lua.in index c34d5b95758addd3b01340933dd979770a6f8bd2..4df66273dcd84d986c643ceeed27dc6c8e9d1f3c 100644 --- a/daemon/lua/sandbox.lua.in +++ b/daemon/lua/sandbox.lua.in @@ -469,7 +469,24 @@ function eval_cmd(line, raw) end -- Pretty printing -table_print = require('krprint').pprint +local pprint = require('krprint').pprint +function table_print(...) + local strs = {} + local nargs = select('#', ...) + if nargs == 0 then + return nil + end + for n=1,nargs do + local arg = select(n, ...) + local arg_str = pprint(arg) + if nargs > 1 then + table.insert(strs, string.format("%s\t-- result # %d", arg_str, n)) + else + table.insert(strs, arg_str) + end + end + return table.concat(strs, '\n') +end -- This extends the worker module to allow asynchronous execution of functions and nonblocking I/O. -- The current implementation combines cqueues for Lua interface, and event.socket() in order to not