audio.pause()

Type Function
Library audio.*
Return value Number
Revision Release 2022.3683
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 )