From c847fef4095aa82d66fa3b0891298005362a4dfd Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Sat, 1 Mar 2025 19:17:17 +0100 Subject: 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. --- doc_topics/03-terminal.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc_topics') 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: sys.setnonblock(io.stdin, true) -Both functions require a timeout to be provided which allows for proper asynchronous -code to be written. Since the underlying sleep method used is `system.sleep`, just patching -that function with a coroutine based yielding one should be all that is needed to make -the result work with asynchroneous coroutine schedulers. +Both `readkey` and `readansi` require a timeout to be provided which allows for proper asynchronous +code to be written. The underlying sleep method to use can be provided, and defaults to `system.sleep`. +Just passing a coroutine enabled sleep method should be all that is needed to make +the result work with asynchroneous coroutine schedulers. Alternatively just patch `system.sleep`. ### 3.3.2 Blocking input -- cgit v1.2.3-55-g6feb