Skip to main content

Validate

Checks an Types.AgentDefinition or a Types.Brain and errors with the path of the first bad field. Build() and VluxyAI.NewAgent run it for you; call VluxyAI.Validate yourself to check content modules in a test.

Functions​

Brain​

Validate.Brain(
brain: any,--

The candidate brain.

path: string?--

The prefix for messages. Default Brain.

) → ()

Checks a brain table: Initial names a state, every state's functions are functions, every transition targets a state, and no field is misspelled. The 0.1 names Start and End are called out by name.

Errors

TypeDescription
stringThe path and problem of the first bad field.

Definition​

Validate.Definition(
definition: any--

The candidate definition.

) → ()

Checks a whole definition against [Types.AgentDefinition]: the entity, the brain (through Validate.Brain), that a pathfinder and a mover come as a pair and have their methods, that every sense has Tick, and that the numbers are numbers.

The entity may be a plain table in a test; a real Instance must be a Model with a PrimaryPart. It may be left out when the mover has GetPivot (Record): a headless agent.

Errors

TypeDescription
stringThe path and problem of the first bad field.
Show raw api
{
    "functions": [
        {
            "name": "Brain",
            "desc": "Checks a brain table: `Initial` names a state, every state's functions are functions, every\ntransition targets a state, and no field is misspelled. The 0.1 names `Start` and `End` are\ncalled out by name.",
            "params": [
                {
                    "name": "brain",
                    "desc": "The candidate brain.",
                    "lua_type": "any"
                },
                {
                    "name": "path",
                    "desc": "The prefix for messages. Default `Brain`.",
                    "lua_type": "string?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "errors": [
                {
                    "lua_type": "string",
                    "desc": "The path and problem of the first bad field."
                }
            ],
            "source": {
                "line": 180,
                "path": "lib/Brain/Validate.luau"
            }
        },
        {
            "name": "Definition",
            "desc": "Checks a whole definition against [Types.AgentDefinition]: the entity, the brain (through\n[Validate.Brain]), that a pathfinder and a mover come as a pair and have their methods, that\nevery sense has `Tick`, and that the numbers are numbers.\n\nThe entity may be a plain table in a test; a real `Instance` must be a `Model` with a\n`PrimaryPart`. It may be left out when the mover has `GetPivot` ([Record]): a headless agent.",
            "params": [
                {
                    "name": "definition",
                    "desc": "The candidate definition.",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "static",
            "errors": [
                {
                    "lua_type": "string",
                    "desc": "The path and problem of the first bad field."
                }
            ],
            "source": {
                "line": 297,
                "path": "lib/Brain/Validate.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Validate",
    "desc": "Checks an [Types.AgentDefinition] or a [Types.Brain] and errors with the path of the first bad\nfield. `Build()` and `VluxyAI.NewAgent` run it for you; call `VluxyAI.Validate` yourself to\ncheck content modules in a test.",
    "source": {
        "line": 169,
        "path": "lib/Brain/Validate.luau"
    }
}