Skip to main content

Monitor

The callbacks of a query monitor, made by Query:monitor. Its functions are called with a dot: monitor.added(fn).

Functions​

added​

Monitor.added(
callback: ((entity: Entity) → ())?--

nil clears it

) → ()

Sets the callback for the entities that start matching the query.

removed​

Monitor.removed(
callback: ((entity: Entity) → ())?--

nil clears it

) → ()

Sets the callback for the entities that stop matching the query. It runs before the ids are removed: the values of the entity can still be read.

disconnect​

Monitor.disconnect() → ()

Stops the monitor: no callback runs after it, and it stops listening to the signals of the ids. Calling it again does nothing.

Show raw api
{
    "functions": [
        {
            "name": "added",
            "desc": "Sets the callback for the entities that start matching the query.",
            "params": [
                {
                    "name": "callback",
                    "desc": "nil clears it",
                    "lua_type": "((entity: Entity) -> ())?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1411,
                "path": "src/init.luau"
            }
        },
        {
            "name": "removed",
            "desc": "Sets the callback for the entities that stop matching the query. It runs before the ids\nare removed: the values of the entity can still be read.",
            "params": [
                {
                    "name": "callback",
                    "desc": "nil clears it",
                    "lua_type": "((entity: Entity) -> ())?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1419,
                "path": "src/init.luau"
            }
        },
        {
            "name": "disconnect",
            "desc": "Stops the monitor: no callback runs after it, and it stops listening to the signals of the\nids. Calling it again does nothing.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1426,
                "path": "src/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Monitor",
    "desc": "The callbacks of a query monitor, made by [Query:monitor]. Its functions are called with\na dot: `monitor.added(fn)`.",
    "source": {
        "line": 1404,
        "path": "src/init.luau"
    }
}