diff --git a/doc/stub/global.lua b/doc/stub/global.lua index c9eabf221..5d81da154 100644 --- a/doc/stub/global.lua +++ b/doc/stub/global.lua @@ -28,7 +28,7 @@ thread, not the whole program. > need to receive events while sleeping, consider using [timers][`os.startTimer`], > or the [parallel API][`parallel`]. -@tparam number time The number of seconds to sleep for, rounded up to the +@tparam[opt=0] number time The number of seconds to sleep for, rounded up to the nearest multiple of 0.05. @see os.startTimer @@ -37,6 +37,8 @@ nearest multiple of 0.05. print("Sleeping for three seconds") sleep(3) print("Done!") + +@changed 1.63 The `time` parameter is now optional. ]] function sleep(time) end diff --git a/doc/stub/os.lua b/doc/stub/os.lua index d48437409..db2fa297a 100644 --- a/doc/stub/os.lua +++ b/doc/stub/os.lua @@ -91,8 +91,8 @@ function pullEventRaw(filter) end --- Pauses execution for the specified number of seconds, alias of [`_G.sleep`]. -- --- @tparam number time The number of seconds to sleep for, rounded up to the --- nearest multiple of 0.05. +-- @tparam[opt=0] number time The number of seconds to sleep for, rounded up to +-- the nearest multiple of 0.05. function sleep(time) end --- Get the current CraftOS version (for example, `CraftOS 1.9`). diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md b/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md index 44a46277a..bb76c8ab2 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md @@ -1434,6 +1434,7 @@ And several bug fixes: * Turtle label nameplates now only show when the Turtle is moused-over * The HTTP API is now enabled by default, and can be configured with a whitelist of permitted domains * `http.get()` and `http.post()` now accept parameters to control the request headers +* `sleep()`, when invoked without a parameter, defaults to 0. * New fs function: `fs.getDir( path )` * Fixed some bugs