diff options
author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2025-03-01 19:17:17 +0100 |
---|---|---|
committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2025-03-02 19:40:15 +0100 |
commit | 2981db32130b30c9b12e7347bfdbe2e7584e9274 (patch) | |
tree | 9dc1330b743b9f4aed15d92c8036a5a41024fc87 /doc_topics | |
parent | bdd02cba9ffa1eee3684063b46091f2f868b32b8 (diff) | |
download | luasystem-2981db32130b30c9b12e7347bfdbe2e7584e9274.tar.gz luasystem-2981db32130b30c9b12e7347bfdbe2e7584e9274.tar.bz2 luasystem-2981db32130b30c9b12e7347bfdbe2e7584e9274.zip |
feat(readkey): allow a sleep function to be passed
There are cases where both a blocking and non-blocking sleep is
needed. In those cases just poatching system.sleep isn't good
enough. Hence now we can pass a sleep function.
Diffstat (limited to 'doc_topics')
-rw-r--r-- | doc_topics/03-terminal.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc_topics/03-terminal.md b/doc_topics/03-terminal.md index 9bad359..5bdf543 100644 --- a/doc_topics/03-terminal.md +++ b/doc_topics/03-terminal.md | |||
@@ -112,10 +112,10 @@ To use non-blocking input here's how to set it up: | |||
112 | sys.setnonblock(io.stdin, true) | 112 | sys.setnonblock(io.stdin, true) |
113 | 113 | ||
114 | 114 | ||
115 | Both functions require a timeout to be provided which allows for proper asynchronous | 115 | Both `readkey` and `readansi` require a timeout to be provided which allows for proper asynchronous |
116 | code to be written. Since the underlying sleep method used is `system.sleep`, just patching | 116 | code to be written. The underlying sleep method to use can be provided, and defaults to `system.sleep`. |
117 | that function with a coroutine based yielding one should be all that is needed to make | 117 | Just passing a coroutine enabled sleep method should be all that is needed to make |
118 | the result work with asynchroneous coroutine schedulers. | 118 | the result work with asynchroneous coroutine schedulers. Alternatively just patch `system.sleep`. |
119 | 119 | ||
120 | ### 3.3.2 Blocking input | 120 | ### 3.3.2 Blocking input |
121 | 121 | ||