6Q6XGOFLRHPFQPVUKYTRWS4BKJ6G65IUWSS7HBQKV5HYZDEYCICAC
function eval(buf)
local f = load('return '..buf, 'REPL')
if f then
return call_gather(f)
end
local f, err = load(buf, 'REPL')
if f then
return call_gather(f)
else
return {err}
end
end
-- based on https://github.com/hoelzro/lua-repl
function call_gather(f)
local success, results = gather_results(xpcall(f, function(...) return debug.traceback() end))
return results
end
function gather_results(success, ...)
local n = select('#', ...)
return success, { n = n, ... }
end