1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-11-05 17:46:21 +00:00

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" githubRelease = "2.5.2"
gradleVersions = "0.50.0" gradleVersions = "0.50.0"
ideaExt = "1.1.7" ideaExt = "1.1.7"
illuaminate = "0.1.0-69-gf294ab2" illuaminate = "0.1.0-71-g378d86e"
librarian = "1.+" librarian = "1.+"
lwjgl = "3.3.3" lwjgl = "3.3.3"
minotaur = "2.+" minotaur = "2.+"

View File

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