lia.voice

Helper library for managing voice lines.

Functions

defineClass(class, onCheck, onModify, global)

Defines a voice class with specific callbacks.

Parameters

  • class String

    The class identifier.

  • onCheck Function

    Callback to determine if the client belongs to this class.

  • onModify Function

    Callback to modify voice sounds based on the class.

  • global Boolean

    Whether the class applies globally.

getClass(client)

Retrieves definitions of voice classes applicable to a client.

Parameters

  • client Player

    The client to check.

Returns

  • table

    An array of class definitions.

getVoiceList(class, text, delay)

Retrieves voice line replacements for a specific class and text.

Parameters

  • class String

    The voice class identifier.

  • text String

    The text to match for replacements.

  • delay number

    Optional delay before each replacement.

Returns

  • table or nil

    An array of replacements or nil if none found.

  • string or nil

    The modified text after replacements or nil if none found.

register(class, key, replacement, source)

Registers a voice line replacement for a specific class and key.

Parameters

  • class String

    The voice class identifier.

  • key String

    The key for the voice line.

  • replacement String

    The replacement text or sound file.

  • source

    The source of the replacement (can be a string or table of strings).