diff options
| author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2025-03-02 19:45:04 +0100 |
|---|---|---|
| committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2025-03-02 19:50:39 +0100 |
| commit | 9318a7dc9f7def35a2e9d85ccffe63c06950be09 (patch) | |
| tree | 945278ce1ce56e225289204f13ac8528264bbb92 /docs/examples | |
| parent | 2981db32130b30c9b12e7347bfdbe2e7584e9274 (diff) | |
| download | luasystem-9318a7dc9f7def35a2e9d85ccffe63c06950be09.tar.gz luasystem-9318a7dc9f7def35a2e9d85ccffe63c06950be09.tar.bz2 luasystem-9318a7dc9f7def35a2e9d85ccffe63c06950be09.zip | |
Release v0.5.0v0.5.0
Diffstat (limited to 'docs/examples')
| -rw-r--r-- | docs/examples/compat.lua.html | 2 | ||||
| -rw-r--r-- | docs/examples/flag_debugging.lua.html | 2 | ||||
| -rw-r--r-- | docs/examples/password_input.lua.html | 2 | ||||
| -rw-r--r-- | docs/examples/read.lua.html | 2 | ||||
| -rw-r--r-- | docs/examples/readline.lua.html | 10 | ||||
| -rw-r--r-- | docs/examples/spinner.lua.html | 2 | ||||
| -rw-r--r-- | docs/examples/spiral_snake.lua.html | 2 | ||||
| -rw-r--r-- | docs/examples/terminalsize.lua.html | 2 |
8 files changed, 14 insertions, 10 deletions
diff --git a/docs/examples/compat.lua.html b/docs/examples/compat.lua.html index b887c91..42928b0 100644 --- a/docs/examples/compat.lua.html +++ b/docs/examples/compat.lua.html | |||
| @@ -112,7 +112,7 @@ | |||
| 112 | </div> <!-- id="main" --> | 112 | </div> <!-- id="main" --> |
| 113 | <div id="about"> | 113 | <div id="about"> |
| 114 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | 114 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> |
| 115 | <i style="float:right;">Last updated 2024-12-18 02:50:03 </i> | 115 | <i style="float:right;">Last updated 2025-03-02 19:43:40 </i> |
| 116 | </div> <!-- id="about" --> | 116 | </div> <!-- id="about" --> |
| 117 | </div> <!-- id="container" --> | 117 | </div> <!-- id="container" --> |
| 118 | </body> | 118 | </body> |
diff --git a/docs/examples/flag_debugging.lua.html b/docs/examples/flag_debugging.lua.html index 8fcf0a9..862cd96 100644 --- a/docs/examples/flag_debugging.lua.html +++ b/docs/examples/flag_debugging.lua.html | |||
| @@ -80,7 +80,7 @@ | |||
| 80 | </div> <!-- id="main" --> | 80 | </div> <!-- id="main" --> |
| 81 | <div id="about"> | 81 | <div id="about"> |
| 82 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | 82 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> |
| 83 | <i style="float:right;">Last updated 2024-12-18 02:50:03 </i> | 83 | <i style="float:right;">Last updated 2025-03-02 19:43:40 </i> |
| 84 | </div> <!-- id="about" --> | 84 | </div> <!-- id="about" --> |
| 85 | </div> <!-- id="container" --> | 85 | </div> <!-- id="container" --> |
| 86 | </body> | 86 | </body> |
diff --git a/docs/examples/password_input.lua.html b/docs/examples/password_input.lua.html index f29e429..cf27497 100644 --- a/docs/examples/password_input.lua.html +++ b/docs/examples/password_input.lua.html | |||
| @@ -132,7 +132,7 @@ useful for reading secrets from the user. | |||
| 132 | </div> <!-- id="main" --> | 132 | </div> <!-- id="main" --> |
| 133 | <div id="about"> | 133 | <div id="about"> |
| 134 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | 134 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> |
| 135 | <i style="float:right;">Last updated 2024-12-18 02:50:03 </i> | 135 | <i style="float:right;">Last updated 2025-03-02 19:43:40 </i> |
| 136 | </div> <!-- id="about" --> | 136 | </div> <!-- id="about" --> |
| 137 | </div> <!-- id="container" --> | 137 | </div> <!-- id="container" --> |
| 138 | </body> | 138 | </body> |
diff --git a/docs/examples/read.lua.html b/docs/examples/read.lua.html index 1d6bb3e..2ffcf1b 100644 --- a/docs/examples/read.lua.html +++ b/docs/examples/read.lua.html | |||
| @@ -143,7 +143,7 @@ sys.<span class="function-name">setnonblock</span>(<span class="global">io</span | |||
| 143 | </div> <!-- id="main" --> | 143 | </div> <!-- id="main" --> |
| 144 | <div id="about"> | 144 | <div id="about"> |
| 145 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | 145 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> |
| 146 | <i style="float:right;">Last updated 2024-12-18 02:50:03 </i> | 146 | <i style="float:right;">Last updated 2025-03-02 19:43:40 </i> |
| 147 | </div> <!-- id="about" --> | 147 | </div> <!-- id="about" --> |
| 148 | </div> <!-- id="container" --> | 148 | </div> <!-- id="container" --> |
| 149 | </body> | 149 | </body> |
diff --git a/docs/examples/readline.lua.html b/docs/examples/readline.lua.html index a78f5b3..ba453ad 100644 --- a/docs/examples/readline.lua.html +++ b/docs/examples/readline.lua.html | |||
| @@ -213,10 +213,12 @@ readline.__index = readline | |||
| 213 | </span><span class="comment">-- @tparam[opt=""] string opts.value the default value | 213 | </span><span class="comment">-- @tparam[opt=""] string opts.value the default value |
| 214 | </span><span class="comment">-- @tparam[opt=<code>#value</code>] number opts.position of the cursor in the input | 214 | </span><span class="comment">-- @tparam[opt=<code>#value</code>] number opts.position of the cursor in the input |
| 215 | </span><span class="comment">-- @tparam[opt={"\10"/"\13"}] table opts.exit_keys an array of keys that will cause the readline to exit | 215 | </span><span class="comment">-- @tparam[opt={"\10"/"\13"}] table opts.exit_keys an array of keys that will cause the readline to exit |
| 216 | </span><span class="comment">-- @tparam[opt=system.sleep] function opts.fsleep the sleep function to use (see <a href="../modules/system.html#readansi">system.readansi</a>) | ||
| 216 | </span><span class="comment">-- @treturn readline the new readline object | 217 | </span><span class="comment">-- @treturn readline the new readline object |
| 217 | </span><span class="keyword">function</span> readline.<span class="function-name">new</span>(opts) | 218 | </span><span class="keyword">function</span> readline.<span class="function-name">new</span>(opts) |
| 218 | <span class="keyword">local</span> value = <span class="function-name">utf8parse</span>(opts.value <span class="keyword">or</span> <span class="string">""</span>) | 219 | <span class="keyword">local</span> value = <span class="function-name">utf8parse</span>(opts.value <span class="keyword">or</span> <span class="string">""</span>) |
| 219 | <span class="keyword">local</span> prompt = <span class="function-name">utf8parse</span>(opts.prompt <span class="keyword">or</span> <span class="string">""</span>) | 220 | <span class="keyword">local</span> prompt = <span class="function-name">utf8parse</span>(opts.prompt <span class="keyword">or</span> <span class="string">""</span>) |
| 221 | <span class="keyword">local</span> fsleep = opts.fsleep <span class="keyword">or</span> sys.sleep | ||
| 220 | <span class="keyword">local</span> pos = <span class="global">math</span>.<span class="function-name">floor</span>(opts.position <span class="keyword">or</span> (#value + <span class="number">1</span>)) | 222 | <span class="keyword">local</span> pos = <span class="global">math</span>.<span class="function-name">floor</span>(opts.position <span class="keyword">or</span> (#value + <span class="number">1</span>)) |
| 221 | pos = <span class="global">math</span>.<span class="function-name">max</span>(<span class="global">math</span>.<span class="function-name">min</span>(pos, (#value + <span class="number">1</span>)), <span class="number">1</span>) | 223 | pos = <span class="global">math</span>.<span class="function-name">max</span>(<span class="global">math</span>.<span class="function-name">min</span>(pos, (#value + <span class="number">1</span>)), <span class="number">1</span>) |
| 222 | <span class="keyword">local</span> len = <span class="global">math</span>.<span class="function-name">floor</span>(opts.max_length <span class="keyword">or</span> <span class="number">80</span>) | 224 | <span class="keyword">local</span> len = <span class="global">math</span>.<span class="function-name">floor</span>(opts.max_length <span class="keyword">or</span> <span class="number">80</span>) |
| @@ -244,6 +246,7 @@ readline.__index = readline | |||
| 244 | </span> position = pos, <span class="comment">-- the current position in the input | 246 | </span> position = pos, <span class="comment">-- the current position in the input |
| 245 | </span> drawn_before = <span class="keyword">false</span>, <span class="comment">-- if the prompt has been drawn | 247 | </span> drawn_before = <span class="keyword">false</span>, <span class="comment">-- if the prompt has been drawn |
| 246 | </span> exit_keys = exit_keys, <span class="comment">-- the keys that will cause the readline to exit | 248 | </span> exit_keys = exit_keys, <span class="comment">-- the keys that will cause the readline to exit |
| 249 | </span> fsleep = fsleep, <span class="comment">-- the sleep function to use | ||
| 247 | </span> } | 250 | </span> } |
| 248 | 251 | ||
| 249 | <span class="global">setmetatable</span>(self, readline) | 252 | <span class="global">setmetatable</span>(self, readline) |
| @@ -482,7 +485,7 @@ readline.__index = readline | |||
| 482 | <span class="keyword">local</span> timeout_end = sys.<span class="function-name">gettime</span>() + timeout | 485 | <span class="keyword">local</span> timeout_end = sys.<span class="function-name">gettime</span>() + timeout |
| 483 | 486 | ||
| 484 | <span class="keyword">while</span> <span class="keyword">true</span> <span class="keyword">do</span> | 487 | <span class="keyword">while</span> <span class="keyword">true</span> <span class="keyword">do</span> |
| 485 | <span class="keyword">local</span> key, keytype = sys.<span class="function-name">readansi</span>(timeout_end - sys.<span class="function-name">gettime</span>()) | 488 | <span class="keyword">local</span> key, keytype = sys.<span class="function-name">readansi</span>(timeout_end - sys.<span class="function-name">gettime</span>(), self.fsleep) |
| 486 | <span class="keyword">if</span> <span class="keyword">not</span> key <span class="keyword">then</span> | 489 | <span class="keyword">if</span> <span class="keyword">not</span> key <span class="keyword">then</span> |
| 487 | <span class="comment">-- error or timeout | 490 | <span class="comment">-- error or timeout |
| 488 | </span> <span class="keyword">return</span> <span class="keyword">nil</span>, keytype | 491 | </span> <span class="keyword">return</span> <span class="keyword">nil</span>, keytype |
| @@ -527,7 +530,8 @@ sys.<span class="function-name">setconsoleflags</span>(<span class="global">io</ | |||
| 527 | value = <span class="string">"Hello, 你-好 World 🚀!"</span>, | 530 | value = <span class="string">"Hello, 你-好 World 🚀!"</span>, |
| 528 | <span class="comment">-- position = 2, | 531 | <span class="comment">-- position = 2, |
| 529 | </span> exit_keys = {key_sequences.enter, <span class="string">"\27"</span>, <span class="string">"\t"</span>, <span class="string">"\27[Z"</span>}, <span class="comment">-- enter, escape, tab, shift-tab | 532 | </span> exit_keys = {key_sequences.enter, <span class="string">"\27"</span>, <span class="string">"\t"</span>, <span class="string">"\27[Z"</span>}, <span class="comment">-- enter, escape, tab, shift-tab |
| 530 | </span>} | 533 | </span> fsleep = sys.sleep, |
| 534 | } | ||
| 531 | 535 | ||
| 532 | 536 | ||
| 533 | <span class="keyword">local</span> result, key = <span class="function-name">rl</span>() | 537 | <span class="keyword">local</span> result, key = <span class="function-name">rl</span>() |
| @@ -545,7 +549,7 @@ sys.<span class="function-name">setconsoleflags</span>(<span class="global">io</ | |||
| 545 | </div> <!-- id="main" --> | 549 | </div> <!-- id="main" --> |
| 546 | <div id="about"> | 550 | <div id="about"> |
| 547 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | 551 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> |
| 548 | <i style="float:right;">Last updated 2024-12-18 02:50:03 </i> | 552 | <i style="float:right;">Last updated 2025-03-02 19:43:40 </i> |
| 549 | </div> <!-- id="about" --> | 553 | </div> <!-- id="about" --> |
| 550 | </div> <!-- id="container" --> | 554 | </div> <!-- id="container" --> |
| 551 | </body> | 555 | </body> |
diff --git a/docs/examples/spinner.lua.html b/docs/examples/spinner.lua.html index b56f1ed..ea992e3 100644 --- a/docs/examples/spinner.lua.html +++ b/docs/examples/spinner.lua.html | |||
| @@ -137,7 +137,7 @@ sys.<span class="function-name">setnonblock</span>(<span class="global">io</span | |||
| 137 | </div> <!-- id="main" --> | 137 | </div> <!-- id="main" --> |
| 138 | <div id="about"> | 138 | <div id="about"> |
| 139 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | 139 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> |
| 140 | <i style="float:right;">Last updated 2024-12-18 02:50:03 </i> | 140 | <i style="float:right;">Last updated 2025-03-02 19:43:40 </i> |
| 141 | </div> <!-- id="about" --> | 141 | </div> <!-- id="about" --> |
| 142 | </div> <!-- id="container" --> | 142 | </div> <!-- id="container" --> |
| 143 | </body> | 143 | </body> |
diff --git a/docs/examples/spiral_snake.lua.html b/docs/examples/spiral_snake.lua.html index 961f506..1f0d582 100644 --- a/docs/examples/spiral_snake.lua.html +++ b/docs/examples/spiral_snake.lua.html | |||
| @@ -145,7 +145,7 @@ codes for moving the cursor around. | |||
| 145 | </div> <!-- id="main" --> | 145 | </div> <!-- id="main" --> |
| 146 | <div id="about"> | 146 | <div id="about"> |
| 147 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | 147 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> |
| 148 | <i style="float:right;">Last updated 2024-12-18 02:50:03 </i> | 148 | <i style="float:right;">Last updated 2025-03-02 19:43:40 </i> |
| 149 | </div> <!-- id="about" --> | 149 | </div> <!-- id="about" --> |
| 150 | </div> <!-- id="container" --> | 150 | </div> <!-- id="container" --> |
| 151 | </body> | 151 | </body> |
diff --git a/docs/examples/terminalsize.lua.html b/docs/examples/terminalsize.lua.html index c01a3d3..a8bb42b 100644 --- a/docs/examples/terminalsize.lua.html +++ b/docs/examples/terminalsize.lua.html | |||
| @@ -110,7 +110,7 @@ sys.<span class="function-name">tcsetattr</span>(<span class="global">io</span>. | |||
| 110 | </div> <!-- id="main" --> | 110 | </div> <!-- id="main" --> |
| 111 | <div id="about"> | 111 | <div id="about"> |
| 112 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | 112 | <i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> |
| 113 | <i style="float:right;">Last updated 2024-12-18 02:50:03 </i> | 113 | <i style="float:right;">Last updated 2025-03-02 19:43:40 </i> |
| 114 | </div> <!-- id="about" --> | 114 | </div> <!-- id="about" --> |
| 115 | </div> <!-- id="container" --> | 115 | </div> <!-- id="container" --> |
| 116 | </body> | 116 | </body> |
