aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2025-04-21 13:19:42 +0200
committerGitHub <noreply@github.com>2025-04-21 13:19:42 +0200
commit722b643d750828f0dd064362ab224a2288ee3bb9 (patch)
tree8debba508e5e9ea7dbd690939835530baf25ec44 /system
parent477dc9f862629b2b63e025e073ce072c5fab9f31 (diff)
downloadluasystem-master.tar.gz
luasystem-master.tar.bz2
luasystem-master.zip
fix(input): maximum sleep delay on backoff 0.1 seconds (#69)HEADmaster
Current setting of 0.2 sometimes makes the response feel sluggish.
Diffstat (limited to 'system')
-rw-r--r--system/init.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/system/init.lua b/system/init.lua
index 9c86c4a..f05b237 100644
--- a/system/init.lua
+++ b/system/init.lua
@@ -239,7 +239,7 @@ end
239do 239do
240 --- Reads a single byte from the console, with a timeout. 240 --- Reads a single byte from the console, with a timeout.
241 -- This function uses `fsleep` to wait until either a byte is available or the timeout is reached. 241 -- This function uses `fsleep` to wait until either a byte is available or the timeout is reached.
242 -- The sleep period is exponentially backing off, starting at 0.0125 seconds, with a maximum of 0.2 seconds. 242 -- The sleep period is exponentially backing off, starting at 0.0125 seconds, with a maximum of 0.1 seconds.
243 -- It returns immediately if a byte is available or if `timeout` is less than or equal to `0`. 243 -- It returns immediately if a byte is available or if `timeout` is less than or equal to `0`.
244 -- 244 --
245 -- Using `system.readansi` is preferred over this function. Since this function can leave stray/invalid 245 -- Using `system.readansi` is preferred over this function. Since this function can leave stray/invalid
@@ -263,7 +263,7 @@ do
263 return nil, err 263 return nil, err
264 end 264 end
265 timeout = timeout - interval 265 timeout = timeout - interval
266 interval = math.min(0.2, interval * 2) 266 interval = math.min(0.1, interval * 2)
267 key = system._readkey() 267 key = system._readkey()
268 end 268 end
269 269