API Reference › Audio › Audio.define
method

Audio.define

Audio.define(name: s, path: p) -> int

Loads a sound file and registers it under name, so Audio.play(name: …) and Audio.play_music(name: …) can fire it without a handle in the game's own state. Returns the handle (0 headless). Assets.enqueue does the same for a .wav / .mp3 path.

Example

# doc-check: skip — illustrative
Audio.define(name: "hit", path: "assets/audio/hit.wav")
Audio.play(name: "hit")
← All symbols