term.restore
From ComputerCraft Wiki
term.restore has been deprecated. term.restore has been removed from ComputerCraft in version 1.6.
|
Function term.restore | |
Using versions of ComputerCraft prior to 1.6, this command switches the terminal back to whatever object it was using to output the display prior to the current one. For example, if you redirect from a computer's screen to an attached Monitor, this command will revert back to the computer's own display. As of version 1.6, ComputerCraft no longer tracks this for you and so term.restore() has been removed. That build instead adds term.current() - this can be used to track the previous trail of displays yourself, hence still allowing you to manually term.redirect() back. | |
Syntax | term.restore() |
Returns | Nothing |
Part of | ComputerCraft |
API | term |
Examples
Example | |
Wraps a monitor at the top of the computer, redirects to it, then restores back to the previous display. Uses term.restore() if available, or term.current() if not. | |
Code |
local mon = peripheral.wrap("top") -- If using a build of ComputerCraft without term.restore, record the current terminal output object: if not term.restore then mon.restoreTo = term.current() end -- Redirect the terminal to the attached monitor: term.redirect(mon) -- Restore back: if term.restore then term.restore() else term.redirect(mon.restoreTo) end |
Additional Notes
- term.restore() will return the monitor to the last used redirect target - meaning that if you have used term.redirect() on two different monitor objects, one use of term.restore() will only restore back to the first redirected monitor, whereas a second would restore back to the original display.
- To restore output directly to the terminal in a single step, use term.redirect(term.native()).