Counter
Implementation of a counter.
Counter:__init()
Constructor.
Counter:add(key, count)
Increments the count for a key.
Arguments:
key(any): key to increment count for.count(int): how much to increment count by.
Returns:
- (
int) the new count
Counter:get(key)
Arguments:
key(any): key to return count for.
Returns:
- (
int) the count for the key
If key has not been added to the counter, then returns 0.
Counter:reset()
Clears the counter.
Returns:
- (
Counter) the modified counter