timer.pause()

Type Function
Library timer.*
Return value Number
Revision 2017.3060
Keywords timer, pause, resume
See also timer.resume()
timer.performWithDelay()

Overview

Pauses a timer started with timer.performWithDelay(). It returns a number that represents the amount of time remaining, in milliseconds.

Syntax

timer.pause( timerId )
timerId (required)

Table. The timer ID from timer.performWithDelay().

Example

local function listener( event )
    print( "listener called" )
end
 
timer1 = timer.performWithDelay( 2000, listener )  -- wait 2 seconds

-- sometime later...
local result = timer.pause( timer1 )
print( "Time remaining is " .. result )