Stopwatch - truemedian/Discordia GitHub Wiki

Used to measure an elapsed period of time. If a truthy value is passed as an argument, then the stopwatch will initialize in an idle state; otherwise, it will initialize in an active state. Although nanosecond precision is available, Lua can only reliably provide microsecond accuracy due to the lack of native 64-bit integer support. Generally, milliseconds should be sufficient here.

Methods

stop
start
reset
getTime

Properties

milliseconds

Methods

:stop( )

Effectively stops the stopwatch.

Returns: nil

:start( )

Effectively starts the stopwatch.

Returns: nil

:reset( )

Effectively resets the stopwatch.

Returns: nil

:getTime( )

Returns a new Time object that represents the currently elapsed time. This is useful for "catching" the current time and comparing its many forms as required.

Returns: Time

Properties

.milliseconds

The total number of elapsed milliseconds. If the stopwatch is running, this will naturally be different each time that it is accessed.

Type: number

⚠️ **GitHub.com Fallback** ⚠️