Sound:play([delay])method


Plays the sound, from its current cursor position

Parameters

[delay]

A number representing an optional delay before the sound is played, in milliseconds (defaulting to 0)

Return value

This function returns a Task, that will end when the sound will finish to play. You can cancel the play by calling Task.cancel() if needed.

Example

--! luart-extensions import audio local console = require "console" -- loads a explosion sound local sound = audio.Sound("boom.wav") sound:play(1000) -- Start the audio from 1000ms sleep((sound.duration+0.8)*1000) console.writecolor("red", "BOOOUUUM !!!\n")