TimeReferenceNew · 0.744
Stopwatch:Reset
Clear the elapsed total and stop the stopwatch.
Details#
Clears all accumulated elapsed time and stops a running stopwatch. After Reset, IsRunning is false and ElapsedTime is zero. Reset does not restart measurement automatically. Call Start explicitly to begin the next interval.
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:Reset(): ()Returns#
No return values. Instance methods require a Stopwatch receiver.
Examples#
Local example
local watch = Stopwatch.new()
watch:Start()
watch:Reset()
print(watch.IsRunning) -- false
watch:Start() -- Begin a fresh measurement.Notes#
- ElapsedTime is a Duration: read .Seconds, .Milliseconds or another duration field. A saved ElapsedTime value does not update itself.