Type Function Library audio.* Return value none Revision 2018.3210 Keywords audio, dispose See also audio.loadSound() audio.loadStream()
Releases audio memory associated with a handle.
You must not use the handle once the memory is freed. The audio should not be active
audio.dispose( audioHandle )
-- Load a laser sound and a background music stream into memory local laserSound = audio.loadSound( "laserSound.wav" ) local backgroundMusic = audio.loadStream( "backgroundMusic.m4a" ) -- Play both the sound and the stream local playLaserSound = audio.play( laserSound ) local playBackgroundMusic = audio.play( backgroundMusic ) -- Stop both the sound and the stream and 'nil' out each reference audio.stop( playLaserSound ) playLaserSound = nil audio.stop( playBackgroundMusic ) playBackgroundMusic = nil -- Dispose the handles from memory and 'nil' out each reference audio.dispose( laserSound ) audio.dispose( backgroundMusic ) laserSound = nil --prevents the handle from being used again backgroundMusic = nil --prevents the handle from being used again