send_errors_to_output = function(err) if err:match('stack overflow') then -- do the bare minimum to maximize chances of showing an error table.insert(Current_pane.output_editor_state.lines, {data=err}) Current_pane.output_editor_state.cursor1 = {line=#Current_pane.output_editor_state.lines, pos=1} Text.redraw_all(Current_pane.output_editor_state) end local callstack = debug.traceback('', 3) local error_with_callstack = cleaned_up_frame(tostring(err))..'\n'..cleaned_up_callstack(callstack) table.insert(Output_editor_state.lines, {data=''}) Output_editor_state.cursor1 = {line=#Output_editor_state.lines, pos=1} Text.redraw_all(Output_editor_state) Text.insert_text(Output_editor_state, error_with_callstack) stop_app() end