From ComputerCraft Wiki
|Redirects terminal output to a monitor, a window, or any other custom terminal object. Once the redirect is performed, any calls to a "term" function - or to a function that makes use of a term function, as as print() - will instead operate with the new terminal object.
The redirect can be undone by pointing back to the previous terminal object (which this function returns whenever you switch). For ComputerCraft builds older than 1.6, use term.restore() to revert instead.Advanced systems running on ComputerCraft 1.6 or later implement multishell, which enables easy multitasking at the expense of some terminal slow-down (all instances of the shell are redirected to a window, increasing the number of function calls involved in any graphical updates). This can be circumvented by way of redirecting to term.native(), at the cost of (somewhat messily) breaking things for users who actually want the multitasking capability.
|Syntax||term.redirect(table terminal object)|
|Returns||table previous terminal object|
|Prints "Hello World!" on the right monitor.|
|Redirects to a monitor, writes some text there, then reverts back to the previous display.|
local mon = peripheral.find("monitor") local oldTerm = term.redirect(mon) print("I'm written on a monitor!") term.redirect(oldTerm)