TimeReferenceNew · 0.744
Stopwatch:Start
Start or resume elapsed-time measurement.
Details#
Starts a stopped stopwatch, preserving its accumulated total. Repeated Start calls while it is already running have no effect and do not restart the interval. Use Reset before Start when you need a fresh measurement rather than another interval added to the previous total.
Fields Stopwatch#
| Field | Type | Meaning |
|---|---|---|
IsRunning | boolean | True while the stopwatch is running; false after construction, Stop or Reset. |
ElapsedTime | Duration | Accumulated elapsed time, including the current interval while running. Each read returns a duration value; read again for a fresh measurement. |
Signature#
watch:Start(): ()Returns#
No return values. Instance methods require a Stopwatch receiver.
Examples#
Local example
local watch = Stopwatch.new()
watch:Start()
watch:Start() -- Already running; the interval continues.
print(watch.IsRunning) -- trueNotes#
- ElapsedTime is a Duration: read .Seconds, .Milliseconds or another duration field. A saved ElapsedTime value does not update itself.