Page 1 of 1

demonnic.Stopwatch : provides an object like interface for Mudlet stopwatches

Posted: Fri Jan 24, 2020 6:35 am
by demonnic
With the extended stopwatch functionality in Mudlet 4.4.0 I decided to write a quick wrapper around Mudlet stopwatches to provide an object like interface to them, not unlike how Geyser provides an object like interface to labels, miniconsoles, and the like.

This is largely a convenience, though I did add a few functions which are more than just wrappers, primarily :isRunning() which returns true if the stopwatch is running, and false otherwise. :getTime() takes an optional format string kind of like getTime() does.
For instance,
Code: [show] | [select all] lua
mySW:getTime("hh:MM:ss:mm")
--returns "01:46:05:709" because the timer's been running one hour, 46 minutes, 5 seconds, and 709 ms. I started it when I started writing documentation
With no argument it will return the time exactly like getStopWatchTime(timerID) does
I also included :getExpandedTable(), which finds and returns the table from the output of getStopWatches() for , which contains the most complete information on any given stopwatch it seems.

The github project for this is at https://github.com/demonnic/stopwatches and the wiki is https://github.com/demonnic/stopwatches/wiki