File HoldDown.lua
Functions
GwHoldDown:clear () | Clear the hold-down timer. |
GwHoldDown:continue () | Continue the hold down, scaling the interval. |
GwHoldDown:hold () | Test the hold-down status. |
GwHoldDown:new (interval, limit) | GwHoldDown constructor function. |
GwHoldDown:set (interval, limit) | Update the timer interval. |
GwHoldDown:start (f) | Start the hold-down interval. |
GwHoldDownCache:hold (s) | Test the hold-down status of an element. |
GwHoldDownCache:new (interval, soft_max, hard_max) | GwHoldDownCache constructor function. |
Functions
- GwHoldDown:clear ()
- Clear the hold-down timer.
- GwHoldDown:continue ()
- Continue the hold down, scaling the interval.
- GwHoldDown:hold ()
-
Test the hold-down status.
Return value:
- True if a hold-down is in effect, false otherwise.
- GwHoldDown:new (interval, limit)
-
GwHoldDown constructor function.
Parameters:
-
interval
: The length, in seconds, of the hold-down interval. -
limit
: The maximum hold time when the continue method is invoked. If no value is supplied, the interval value is used.
Return value:
- An initialized GwHoldDown instance.
-
- GwHoldDown:set (interval, limit)
-
Update the timer interval.
Parameters:
-
interval
: The length, in seconds, of the hold-down interval. -
limit
: The maximum hold time when the continue method is invoked.
Return value:
- The GwHoldDown instance.
-
- GwHoldDown:start (f)
-
Start the hold-down interval.
Parameters:
-
f
: (optional) A callback function that will be called when the timer expires.
Return value:
- The time at which the interval will end.
-
- GwHoldDownCache:hold (s)
-
Test the hold-down status of an element.
Parameters:
-
s
:
Return value:
- True if a hold-down is in effect, false otherwise.
-
- GwHoldDownCache:new (interval, soft_max, hard_max)
-
GwHoldDownCache constructor function.
Parameters:
-
interval
: The length, in seconds, of the hold-down interval. -
soft_max
: Table size threshold for compaction. -
hard_max
: Limit on table size.
Return value:
- An initialized GwHoldDownCache instance.
-