From ComputerCraft Wiki
Revision as of 13:17, 31 March 2014 by Bomb Bloke
|Added by ComputerCraft 1.6, this function returns the current terminal object that is being used to write to; if you intend to redirect elsewhere (eg to an attached Monitor), you may find need to record the identity of the previous object and redirect back to it when done.|
Previously, term.restore() could be used to automatically revert back to the previously used output object - ComputerCraft 1.6 also removes that command.
|Returns||table terminal object|
|Wraps a monitor at the top of the computer, redirects to it, then restores back to the previous display. Uses term.current() if available, or term.restore() if not.|
local mon = peripheral.wrap("top") -- If using a build of ComputerCraft with term.current, record the current terminal output object: if term.current then mon.restoreTo = term.current() end -- Redirect the terminal to the attached monitor: term.redirect(mon) -- Restore back: if term.current then term.redirect(mon.restoreTo) else term.restore() end
- term.current() requires ComputerCraft version 1.6 or newer.