Module terminal.output

Module for writing output.

Note: This module will be available from the main terminal module, without explicitly requiring it.

Example:

local terminal = require "terminal"
terminal.initialize()

terminal.output.write("hello world")

Functions

flush () Flushes the stream.
print (...) Prints to the stream.
set_stream (filehandle) Set the stream to operate on.
write (...) Writes to the stream.


Functions

flush ()
Flushes the stream.

Returns:

    the return value of the stream's flush function
print (...)
Prints to the stream. A print compatible function that safely writes output to the stream. Arguments are separated by a tab character, and a newline is added at the end.

Parameters:

  • ... the values to write
set_stream (filehandle)
Set the stream to operate on. This can be used to redirect output to a different stream. The default value at start is io.stderr.

Instead of calling this directly, it is probably better to use the terminal.initialize function.

Parameters:

Returns:

    true
write (...)

Writes to the stream. This is a safer write-function than the standard Lua one. It doesn't add add tabs between arguments, and it doesn't add a newline at the end (like print does). Differences from the standard Lua write function:

  • parameters will be tostring-ed before writing
  • will flush the stream

Parameters:

  • ... the values to write

Returns:

    the return value of the stream's write function
generated by LDoc 1.5.0