This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
api:term [2017/05/11 18:12] payonel |
api:term [2018/11/15 17:37] (current) payonel |
||
---|---|---|---|
Line 4: | Line 4: | ||
- `term.isAvailable(): boolean` | - `term.isAvailable(): boolean` | ||
- | Returns whether the term API is available for use, i.e. whether a primary GPU an screen are present. In other words, whether `term.read` and `term.write` will actually do something. | + | Returns whether the term API is available for use, i.e. whether a primary GPU and screen are present. In other words, whether `term.read` and `term.write` will actually do something. |
- | - `term.getViewport([window:table]): number, number, number, number, number, number` | + | - `term.getViewport(): number, number, number, number, number, number` |
(new in OpenOS 1.6) | (new in OpenOS 1.6) | ||
| | ||
- | Gets the width, height, x offset, y offset, relative x, and relative y values of the current terminal or `window` if provided. | + | Gets the width, height, x offset, y offset, relative x, and relative y values. |
- | - `term.gpu([window:table]): table` | + | - `term.gpu(): table` |
(new in OpenOS 1.6) | (new in OpenOS 1.6) | ||
| | ||
- | Gets the gpu of the current terminal (or `window` if provided). | + | Gets the gpu proxy used by the term api. |
- `term.pull([...]): ...` | - `term.pull([...]): ...` | ||
(new in OpenOS 1.6) | (new in OpenOS 1.6) | ||
Line 47: | Line 47: | ||
//Note//: This method respects io redirection. That is to say, `term.write` writes to the same stream as io.stdout | //Note//: This method respects io redirection. That is to say, `term.write` writes to the same stream as io.stdout | ||
- | - `term.bind(gpu, screen, [keyboard, [window:table]])` | + | - `term.bind(gpu)` |
(new in OpenOS 1.6) | (new in OpenOS 1.6) | ||
- | Binds component proxies (not addresses) `gpu`, `screen`, and `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. | + | Binds a `gpu` proxy (not address) to the terminal. 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. This changes the gpu used in all terminal output, not just via the term api, i.e. `io.write`, `print`, `io.stdout:write`, etc all use the same output stream, and term.bind is used to change the `gpu` used. |
- | - `term.screen([window:table]): table` | + | - `term.screen(): string` |
(new in OpenOS 1.6) | (new in OpenOS 1.6) | ||
| | ||
- | Gets the screen of the current terminal (or `window` if provided). | + | Convenience method, simply calls `getScreen` on the terminal's bound gpu (see `term.bind`) |
- | - `term.keyboard([window:table]): table` | + | - `term.keyboard(): string` |
(new in OpenOS 1.6) | (new in OpenOS 1.6) | ||
| | ||
- | Gets the keyboard of the current terminal (or `window` if provided). | + | Gets the address of the keyboard the terminal is accepting key events from. |
Line 65: | Line 65: | ||
----------- | ----------- | ||
{{page>api:contents&noheader&noeditbutton&nouser&nofooter}} | {{page>api:contents&noheader&noeditbutton&nouser&nofooter}} | ||
+ |