audio.pause()

Type Function
Library audio.*
Return value Number
Revision 2017.3109
Keywords audio, pause, sound
See also audio.play()
audio.resume()

Overview

Pauses playback on a channel (or all channels if no channels are specified). Has no effect on channels that aren't playing.

This function returns the number of channels actually paused or -1 on error.

Syntax

audio.pause( [channel] )
channel (required)

Number. The channel to pause. Specifying 0 pauses all channels. If channel is omitted, audio.pause() will pause all active channels.

Example

local backgroundMusicChannel = audio.play( backgroundMusic, { loops=-1 }  ) 
audio.pause( backgroundMusicChannel )