aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2024-05-23 20:46:18 +0200
committerThijs Schreijer <thijs@thijsschreijer.nl>2024-05-23 20:57:20 +0200
commit56db1511baeb0376a12915c69c1552b04010c26f (patch)
treed03aa6b4c33a6de39371e9be336c471bfd2cafc5 /system
parent8f8d34f03428dbaa6cac229bbe36efc6d80d186d (diff)
downloadluasystem-56db1511baeb0376a12915c69c1552b04010c26f.tar.gz
luasystem-56db1511baeb0376a12915c69c1552b04010c26f.tar.bz2
luasystem-56db1511baeb0376a12915c69c1552b04010c26f.zip
cleanup and documentation
Diffstat (limited to 'system')
-rw-r--r--system/init.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/system/init.lua b/system/init.lua
index b9a4f6f..8049167 100644
--- a/system/init.lua
+++ b/system/init.lua
@@ -7,7 +7,7 @@ local sys = require 'system.core'
7do 7do
8 local backup_mt = {} 8 local backup_mt = {}
9 9
10 --- Returns a backup of terminal setting for stdin/out/err. 10 --- Returns a backup of terminal settings for stdin/out/err.
11 -- Handles terminal/console flags, Windows codepage, and non-block flags on the streams. 11 -- Handles terminal/console flags, Windows codepage, and non-block flags on the streams.
12 -- Backs up terminal/console flags only if a stream is a tty. 12 -- Backs up terminal/console flags only if a stream is a tty.
13 -- @return table with backup of terminal settings 13 -- @return table with backup of terminal settings
@@ -227,8 +227,11 @@ do
227 -- This function uses `system.sleep` to wait until either a byte is available or the timeout is reached. 227 -- This function uses `system.sleep` to wait until either a byte is available or the timeout is reached.
228 -- The sleep period is exponentially backing off, starting at 0.0125 seconds, with a maximum of 0.2 seconds. 228 -- The sleep period is exponentially backing off, starting at 0.0125 seconds, with a maximum of 0.2 seconds.
229 -- It returns immediately if a byte is available or if `timeout` is less than or equal to `0`. 229 -- It returns immediately if a byte is available or if `timeout` is less than or equal to `0`.
230 --
231 -- Using `system.readansi` is preferred over this function. Since this function can leave stray/invalid
232 -- byte-sequences in the input buffer, while `system.readansi` reads full ANSI and UTF8 sequences.
230 -- @tparam number timeout the timeout in seconds. 233 -- @tparam number timeout the timeout in seconds.
231 -- @treturn[1] integer the key code of the key that was received 234 -- @treturn[1] byte the byte value that was read.
232 -- @treturn[2] nil if no key was read 235 -- @treturn[2] nil if no key was read
233 -- @treturn[2] string error message; `"timeout"` if the timeout was reached. 236 -- @treturn[2] string error message; `"timeout"` if the timeout was reached.
234 function sys.readkey(timeout) 237 function sys.readkey(timeout)