call_protected = function(f, ...) local args = {...} xpcall( function() print = print_to_output f(unpack(args)) print = Real_print end, send_errors_to_output) end