Skip to main content

Sound

The sound interface

Sound.play { path = "misc/spawn", vol = 0.5 }

Functions

play

Sound.play(
optionstable--

settings

) → SoundRef--

instance

Play a sound effect

Options

Name Type Default Description
path string - sound file path
vol number 1 sound volume
pan number 0 pan value in range [-1, 1]
loops number - amount of additional loops
x number - horizontal pan coordinate
Show raw api
{
    "functions": [
        {
            "name": "play",
            "desc": "Play a sound effect\n\n### Options\n| Name            | Type        | Default | Description                    |\n|-----------------|-------------|---------|--------------------------------|\n| path            | string      |       - | sound file path                |\n| vol             | number      |       1 | sound volume                   |\n| pan             | number      |       0 | pan value in range [-1, 1]     |\n| loops           | number      |       - | amount of additional loops     |\n| x               | number      |       - | horizontal pan coordinate      |",
            "params": [
                {
                    "name": "options",
                    "desc": "settings",
                    "lua_type": "table"
                }
            ],
            "returns": [
                {
                    "desc": "instance",
                    "lua_type": "SoundRef"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 26,
                "path": "../../res/data/script/lib/system/sound.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Sound",
    "desc": "The sound interface\n\n```lua\nSound.play { path = \"misc/spawn\", vol = 0.5 }\n```",
    "source": {
        "line": 9,
        "path": "../../res/data/script/lib/system/sound.lua"
    }
}