Small cleanup to OS API docs

- Mention the timer event in os.startTimer. Really we should have a
   similar example here too, but let's at least link the two for now.
 - Fix strftime link
This commit is contained in:
Jonathan Coates 2024-03-24 15:12:23 +00:00
parent e154b0db2a
commit 0d3e00cc41
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
2 changed files with 16 additions and 17 deletions

View File

@ -64,7 +64,7 @@ forgeGradle = "6.0.20"
githubRelease = "2.5.2"
gradleVersions = "0.50.0"
ideaExt = "1.1.7"
illuaminate = "0.1.0-69-gf294ab2"
illuaminate = "0.1.0-71-g378d86e"
librarian = "1.+"
lwjgl = "3.3.3"
minotaur = "2.+"

View File

@ -143,27 +143,27 @@ public final void queueEvent(String name, IArguments args) throws LuaException {
/**
* Starts a timer that will run for the specified number of seconds. Once
* the timer fires, a {@code timer} event will be added to the queue with
* the ID returned from this function as the first parameter.
* the timer fires, a [`timer`] event will be added to the queue with the ID
* returned from this function as the first parameter.
* <p>
* As with [sleep][`os.sleep`], {@code timer} will automatically be rounded up
* to the nearest multiple of 0.05 seconds, as it waits for a fixed amount
* of world ticks.
* As with [sleep][`os.sleep`], the time will automatically be rounded up to
* the nearest multiple of 0.05 seconds, as it waits for a fixed amount of
* world ticks.
*
* @param timer The number of seconds until the timer fires.
* @return The ID of the new timer. This can be used to filter the
* {@code timer} event, or {@link #cancelTimer cancel the timer}.
* @param time The number of seconds until the timer fires.
* @return The ID of the new timer. This can be used to filter the [`timer`]
* event, or {@linkplain #cancelTimer cancel the timer}.
* @throws LuaException If the time is below zero.
* @see #cancelTimer To cancel a timer.
*/
@LuaFunction
public final int startTimer(double timer) throws LuaException {
return apiEnvironment.startTimer(Math.round(checkFinite(0, timer) / 0.05));
public final int startTimer(double time) throws LuaException {
return apiEnvironment.startTimer(Math.round(checkFinite(0, time) / 0.05));
}
/**
* Cancels a timer previously started with startTimer. This will stop the
* timer from firing.
* Cancels a timer previously started with {@link #startTimer(double)}. This
* will stop the timer from firing.
*
* @param token The ID of the timer to cancel.
* @cc.since 1.6
@ -399,10 +399,9 @@ public final long epoch(Optional<String> args) throws LuaException {
* Returns a date string (or table) using a specified format string and
* optional time to format.
* <p>
* The format string takes the same formats as C's {@code strftime} function
* (http://www.cplusplus.com/reference/ctime/strftime/). In extension, it
* can be prefixed with an exclamation mark ({@code !}) to use UTC time
* instead of the server's local timezone.
* The format string takes the same formats as C's [strftime](http://www.cplusplus.com/reference/ctime/strftime/)
* function. The format string can also be prefixed with an exclamation mark
* ({@code !}) to use UTC time instead of the server's local timezone.
* <p>
* If the format is exactly {@code *t} (optionally prefixed with {@code !}), a
* table will be returned instead. This table has fields for the year, month,