escape hatch when print is overridden
This commit is contained in:
parent
38d21ab237
commit
0873264a6a
|
@ -10,12 +10,11 @@ run_button = function(x, y)
|
|||
love.graphics.push('all')
|
||||
love.graphics.setBackgroundColor(1,1,1)
|
||||
edit.clear(Current_pane.output_editor_state)
|
||||
local real_print = print
|
||||
print = print_to_output
|
||||
-- ## run
|
||||
local status, result = live.eval(buf, 'editor')
|
||||
-- ## run: save some stuff, clean up the rest
|
||||
print = real_print
|
||||
print = Real_print
|
||||
if result then
|
||||
-- could be either output or error
|
||||
table.insert(Current_pane.output_editor_state.lines, {data=tostring(result)})
|
||||
|
@ -29,4 +28,4 @@ run_button = function(x, y)
|
|||
end)
|
||||
local w = App.width('run')+10
|
||||
return x+w+10, y
|
||||
end
|
||||
end
|
|
@ -2,10 +2,9 @@ call_protected = function(f, ...)
|
|||
local args = {...}
|
||||
xpcall(
|
||||
function()
|
||||
local old_print = print
|
||||
print = print_to_output
|
||||
f(unpack(args))
|
||||
print = old_print
|
||||
print = Real_print
|
||||
end,
|
||||
send_errors_to_output)
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
Real_print = print
|
Loading…
Reference in New Issue