1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-09 17:00:30 +00:00

Fix wrong link in os.date docs

Should be os.time, not os.date! Fixes #1999
This commit is contained in:
Jonathan Coates 2024-10-24 14:03:06 +01:00
parent d6a246c122
commit c271ed7c7f
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06

View File

@ -403,21 +403,39 @@ public class OSAPI implements ILuaAPI {
* function. The format string can also be prefixed with an exclamation mark * function. The format string can also be prefixed with an exclamation mark
* ({@code !}) to use UTC time instead of the server's local timezone. * ({@code !}) to use UTC time 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"} (or {@code "!*t"} ), a table
* table will be returned instead. This table has fields for the year, month, * representation of the timestamp will be returned instead. This table has
* day, hour, minute, second, day of the week, day of the year, and whether * fields for the year, month, day, hour, minute, second, day of the week,
* Daylight Savings Time is in effect. This table can be converted to a UNIX * day of the year, and whether Daylight Savings Time is in effect. This
* timestamp (days since 1 January 1970) with {@link #date}. * table can be converted back to a timestamp with {@link #time(IArguments)}.
* *
* @param formatA The format of the string to return. This defaults to {@code %c}, which expands to a string similar to "Sat Dec 24 16:58:00 2011". * @param formatA The format of the string to return. This defaults to {@code %c}, which expands to a string similar to "Sat Dec 24 16:58:00 2011".
* @param timeA The time to convert to a string. This defaults to the current time. * @param timeA The timestamp to convert to a string. This defaults to the current time.
* @return The resulting format string. * @return The resulting formated string, or table.
* @throws LuaException If an invalid format is passed. * @throws LuaException If an invalid format is passed.
* @cc.since 1.83.0 * @cc.since 1.83.0
* @cc.usage Print the current date in a user-friendly string. * @cc.usage Print the current date in a user-friendly string.
* <pre>{@code * <pre>{@code
* os.date("%A %d %B %Y") -- See the reference above! * os.date("%A %d %B %Y") -- See the reference above!
* }</pre> * }</pre>
*
* @cc.usage Convert a timestamp to a table.
* <pre>{@code
* os.date("!*t", 1242534247)
* --[=[ {
* -- Date
* year = 2009,
* month = 5,
* day = 17,
* yday = 137,
* wday = 1,
* -- Time
* hour = 4,
* min = 24,
* sec = 7,
* isdst = false,
* } ]=]
* }</pre>
*/ */
@LuaFunction @LuaFunction
public final Object date(Optional<String> formatA, Optional<Long> timeA) throws LuaException { public final Object date(Optional<String> formatA, Optional<Long> timeA) throws LuaException {