From 0d3e00cc416f7e3732bb4f2f9c200a7452b7ea73 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Sun, 24 Mar 2024 15:12:23 +0000 Subject: [PATCH] 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 --- gradle/libs.versions.toml | 2 +- .../dan200/computercraft/core/apis/OSAPI.java | 31 +++++++++---------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f108cea40..7a8512048 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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.+" diff --git a/projects/core/src/main/java/dan200/computercraft/core/apis/OSAPI.java b/projects/core/src/main/java/dan200/computercraft/core/apis/OSAPI.java index 4540acd50..43685ab7a 100644 --- a/projects/core/src/main/java/dan200/computercraft/core/apis/OSAPI.java +++ b/projects/core/src/main/java/dan200/computercraft/core/apis/OSAPI.java @@ -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. *

- * 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 args) throws LuaException { * Returns a date string (or table) using a specified format string and * optional time to format. *

- * 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. *

* 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,