diff options
| -rw-r--r-- | README.md | 98 |
1 files changed, 98 insertions, 0 deletions
| @@ -35,6 +35,104 @@ Usage | |||
| 35 | term.cursor.restore() -- restore position | 35 | term.cursor.restore() -- restore position |
| 36 | ``` | 36 | ``` |
| 37 | 37 | ||
| 38 | `term` Functions | ||
| 39 | -------------- | ||
| 40 | |||
| 41 | Some functions in lua-term take an optional file handle argument; if this is | ||
| 42 | not provided, `io.stdout` is used. | ||
| 43 | |||
| 44 | ### `term.clear([opt_file])` | ||
| 45 | |||
| 46 | Clear the terminal's contents. | ||
| 47 | |||
| 48 | ### `term.cleareol([opt_file])` | ||
| 49 | |||
| 50 | Clear from the current cursor position to the end of the current line. | ||
| 51 | |||
| 52 | `term.colors` Values | ||
| 53 | ------------------ | ||
| 54 | |||
| 55 | The following values are available in `term.colors`: | ||
| 56 | |||
| 57 | ### Terminal Attributes | ||
| 58 | |||
| 59 | * reset | ||
| 60 | * clear (a synonym for reset) | ||
| 61 | * bright | ||
| 62 | * dim | ||
| 63 | * underscore | ||
| 64 | * blink | ||
| 65 | * reverse | ||
| 66 | * hidden | ||
| 67 | |||
| 68 | ### Foreground Colors | ||
| 69 | |||
| 70 | * black | ||
| 71 | * red | ||
| 72 | * green | ||
| 73 | * yellow | ||
| 74 | * blue | ||
| 75 | * magenta | ||
| 76 | * cyan | ||
| 77 | * white | ||
| 78 | |||
| 79 | ### Background Colors | ||
| 80 | |||
| 81 | * onblack | ||
| 82 | * onred | ||
| 83 | * ongreen | ||
| 84 | * onyellow | ||
| 85 | * onblue | ||
| 86 | * onmagenta | ||
| 87 | * oncyan | ||
| 88 | * onwhite | ||
| 89 | |||
| 90 | Every value in `term.colors` may be used in several ways: | ||
| 91 | |||
| 92 | ### As a Function | ||
| 93 | |||
| 94 | ```lua | ||
| 95 | print(colors.red 'hello') | ||
| 96 | ``` | ||
| 97 | |||
| 98 | ### As a String | ||
| 99 | |||
| 100 | ```lua | ||
| 101 | print(colors.red .. 'hello' .. colors.reset) | ||
| 102 | print(colors.red, 'hello', colors.reset) | ||
| 103 | ``` | ||
| 104 | |||
| 105 | `term.cursor` Functions | ||
| 106 | --------------------- | ||
| 107 | |||
| 108 | ### `term.cursor.goto([opt_file], x, y)` | ||
| 109 | |||
| 110 | Place the cursor at (`x`, `y`). | ||
| 111 | |||
| 112 | ### `term.cursor.goup([opt_file], nlines)` | ||
| 113 | |||
| 114 | Moves the cursor up `nlines` lines. | ||
| 115 | |||
| 116 | ### `term.cursor.godown([opt_file], nlines)` | ||
| 117 | |||
| 118 | Moves the cursor down `nlines` lines. | ||
| 119 | |||
| 120 | ### `term.cursor.goright([opt_file], ncols)` | ||
| 121 | |||
| 122 | Moves the cursor right `ncols` columns. | ||
| 123 | |||
| 124 | ### `term.cursor.goleft([opt_file], ncols)` | ||
| 125 | |||
| 126 | Moves the cursor left `ncols` columns. | ||
| 127 | |||
| 128 | ### `term.cursor.save([opt_file])` | ||
| 129 | |||
| 130 | Saves the cursor position. | ||
| 131 | |||
| 132 | ### `term.cursor.restore([opt_file])` | ||
| 133 | |||
| 134 | Restores the cursor position. | ||
| 135 | |||
| 38 | Alternatives | 136 | Alternatives |
| 39 | ------------ | 137 | ------------ |
| 40 | 138 | ||
