term.current

Returns the current terminal object of the computer. This is useful to keep track of terminal objects when term.redirect was used.

ExampleReturn to the previous term
Finds a monitor, redirects the term object and afterwards redirects back to the original term.
Code
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.

term.current
Function
Syntax
term.current()
Returns table
API term
Source CC:Tweaked
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.