Provides a simplified way of writing text to screens and reading user input, so you don't have to manually interact with the GPU API for these cases.
term.writewill actually do something.
term.getViewport([window:table]): number, number, number, number, number, number
event.pulltaking the same parameters and returning the same results. This method is used to blink the cursor while waiting for an event result.
term.getCursor(): number, number
term.setCursor(col: number, row: number)
term.read([history: table[, dobreak:boolean[, hint:table or function[, pwchar:string]]]]): string
optionsargument. The indexed array values are treated as
history, named keys take the place of legacy arguments. For compatibility, OpenOS 1.6 will respect the previous usage, i.e. parameter list.
opsparameter supports a new key,
nowrap. The default behavior of term.read wrap the cursor and input vertically. Legacy behavior scrolled the input horizontally, i.e.
history table can be used to provide predefined text that can be cycled through via the up and down arrow keys. It must be a sequence (i.e. the keys must be a gap-less integral interval starting at 1). This is used for the command history in shell and Lua interpreter, for example. If text is entered and confirmed with enter, it will be added to the end of this table.
dobreak parameter, when set to
nil defaults to
true!) will not enter a new line after input was completed (e.g. by the user pressing enter).
hint parameter is used for tab completion. It can either be a table with strings or a function that returns a table of strings and takes two parameters, the current text and the position in that text, i.e. the signature of the callback is
pwchar parameter, when given, causes input to be masked using the first char of the given string. For example, providing
"*" will make all entered characters appear as stars. The returned value will still be the actual text inserted, of course.
The function will return a string if input was successful,
nil if the pipe was closed (^d), or
false if the pipe was interrupted (^c)
io.stdin:read() uses this function.
Note 2: This will return the entered string with the \n (new line character). If you want only the entered string to be returned, use
term.write(value: string[, wrap: boolean])
wrapis true, it will automatically word-wrap the text. It will scroll the displayed buffer if the cursor exceeds the bottom of the display area, but not if it exceeds the right of the display area (when
term.writewrites to the same stream as io.stdout
term.bind(gpu, screen, [keyboard, [window:table]])
(new in OpenOS 1.6)
Binds component proxies (not addresses)
keyboard to the current terminal window or
window. This method is called automatically during boot when the gpu and screen become available. Note that if manually rebinding a terminal to a screen with different width and height, the terminal draw area will be truncated and not maximized.