Document sleep()'s optional parameter (#2488)

This commit is contained in:
Tomodachi94
2026-07-26 07:40:00 +00:00
committed by GitHub
parent 7ab92628d9
commit 2b0adaea5c
3 changed files with 6 additions and 3 deletions
+3 -1
View File
@@ -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
+2 -2
View File
@@ -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`).
@@ -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