Skip to main content

Schema

RequiresSchema

Reads the schema: the definitions the library builds sounds from.

Definitions are decoded out of the compiled schema the first time they are asked for. GetDefinition decodes one. Get and GetDefinitions decode every remaining one and then freeze the definitions table.

Types​

SoundSchema​

interface SoundSchema {
SoundGroupContainer: SoundGroup--

Main SoundGroup for all other SoundGroups.

SoundGroups: SoundGroups--

Dictionary of SoundGroups under the Main SoundGroup.

UnattachedSounds: Configuration--

Configuration for Un-Parented Sounds.

WarmedSounds: Configuration--

Configuration for Warmed Sounds.

PreloadedSounds: Configuration--

Configuration for Preloaded Sounds.

SoundDefinitions: SoundDefinitions--

Dictionary of SoundDefinitions.

PreloadNames: {string}--

Names of the sounds the client preloads on startup.

}

The Schema for the library that is shared on client and server.

Functions​

Get​

Schema.Get() → SoundSchema--

The frozen schema.

Returns the full schema. Decodes every definition that has not been decoded yet.

local schema = VluxySF.Schema.Get()

print(schema.PreloadNames)

GetDefinitions​

Schema.GetDefinitions() → SoundDefinitions--

The frozen definitions.

Returns every definition, keyed by sound name. Decodes every definition that has not been decoded yet.

for name, definition in pairs(VluxySF.Schema.GetDefinitions()) do
	print(name, definition.EffectsCount)
end

GetDefinition​

Schema.GetDefinition(
definitionName: string--

The sound name.

) → SoundDefinition?--

The frozen definition, or nil.

Returns one definition. Prints a warning when the name is not in the schema.

local definition = VluxySF.Schema.GetDefinition("MySound")

if definition then
	print(definition.Properties.SoundId)
end

GetNames​

Schema.GetNames() → {string}--

A new array of every sound name.

print(VluxySF.Schema.GetNames())
Show raw api
{
    "functions": [
        {
            "name": "Get",
            "desc": "Returns the full schema. Decodes every definition that has not been decoded yet.\n\n```lua\nlocal schema = VluxySF.Schema.Get()\n\nprint(schema.PreloadNames)\n```",
            "params": [],
            "returns": [
                {
                    "desc": "The frozen schema.",
                    "lua_type": "SoundSchema"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 33,
                "path": "lib/Api/Schema.luau"
            }
        },
        {
            "name": "GetDefinitions",
            "desc": "Returns every definition, keyed by sound name. Decodes every definition that has not been decoded yet.\n\n```lua\nfor name, definition in pairs(VluxySF.Schema.GetDefinitions()) do\n\tprint(name, definition.EffectsCount)\nend\n```",
            "params": [],
            "returns": [
                {
                    "desc": "The frozen definitions.",
                    "lua_type": "SoundDefinitions"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 54,
                "path": "lib/Api/Schema.luau"
            }
        },
        {
            "name": "GetDefinition",
            "desc": "Returns one definition. Prints a warning when the name is not in the schema.\n\n```lua\nlocal definition = VluxySF.Schema.GetDefinition(\"MySound\")\n\nif definition then\n\tprint(definition.Properties.SoundId)\nend\n```",
            "params": [
                {
                    "name": "definitionName",
                    "desc": "The sound name.",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "The frozen definition, or `nil`.",
                    "lua_type": "SoundDefinition?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 77,
                "path": "lib/Api/Schema.luau"
            }
        },
        {
            "name": "GetNames",
            "desc": "```lua\nprint(VluxySF.Schema.GetNames())\n```",
            "params": [],
            "returns": [
                {
                    "desc": "A new array of every sound name.",
                    "lua_type": "{ string }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 97,
                "path": "lib/Api/Schema.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "SoundSchema",
            "desc": "The `Schema` for the library that is shared on client and server.",
            "fields": [
                {
                    "name": "SoundGroupContainer",
                    "lua_type": "SoundGroup",
                    "desc": "Main `SoundGroup` for all other `SoundGroups`."
                },
                {
                    "name": "SoundGroups",
                    "lua_type": "SoundGroups",
                    "desc": "Dictionary of `SoundGroups` under the Main `SoundGroup`."
                },
                {
                    "name": "UnattachedSounds",
                    "lua_type": "Configuration",
                    "desc": "`Configuration` for Un-Parented `Sounds`."
                },
                {
                    "name": "WarmedSounds",
                    "lua_type": "Configuration",
                    "desc": "`Configuration` for `Warmed` `Sounds`."
                },
                {
                    "name": "PreloadedSounds",
                    "lua_type": "Configuration",
                    "desc": "`Configuration` for `Preloaded` `Sounds`."
                },
                {
                    "name": "SoundDefinitions",
                    "lua_type": "SoundDefinitions",
                    "desc": "Dictionary of `SoundDefinitions`."
                },
                {
                    "name": "PreloadNames",
                    "lua_type": "{ string }",
                    "desc": "Names of the sounds the client preloads on startup."
                }
            ],
            "source": {
                "line": 25,
                "path": "lib/Types.luau"
            }
        }
    ],
    "name": "Schema",
    "desc": "Reads the schema: the definitions the library builds sounds from.\n\nDefinitions are decoded out of the compiled schema the first time they are asked for. `GetDefinition` decodes one.\n`Get` and `GetDefinitions` decode every remaining one and then freeze the definitions table.",
    "tags": [
        "RequiresSchema"
    ],
    "source": {
        "line": 18,
        "path": "lib/Api/Schema.luau"
    }
}