Skip to content
Snippets Groups Projects
Verified Commit 1e00c1e9 authored by Petr Špaček's avatar Petr Špaček
Browse files

table_print: print multiple values

This change allows sandbox to pretty-print return values from functions
which return multiple values, e.g. future net.bufsize() from MR !1026.
parent 7c062ff4
No related merge requests found
Pipeline #66134 failed with stages
in 41 seconds
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment