Term API

From ComputerCraft
Jump to navigation Jump to search
Returns the current terminal object of the computer. This is useful to keep track of terminal objects when term.redirect was used.
Syntax term.current()
Returns table
Part of CC:Tweaked
API term
ExampleExampleReturn to the previous term
Finds a monitor, redirects the term object and afterwards redirects back to the original term.
local mon = peripheral.find("monitor")
local previousTerm = term.current()
term.redirect(mon) -- Redirects the terminal object to a monitor.
term.write("Hello, World") -- This will show on the monitor
term.redirect(previousTerm) -- Redirects back to the original terminal object.
Output Prints "Hello, World" on the first monitor peripheral.find discovers.

Returns the native terminal object of the current computer. This is useful if you want to return to your previous term when term.redirect was used. It is recommended that you avoid using this function when possible. May cause problems with multi-shell and other windowed applications. Instead keep track of the terminal object you want to return to using term.current.
Syntax term.native()
Returns table
Part of CC:Tweaked
API term