Skip to main content

QueryResult

An iterable object returned as the result of Route:query that can filter snapshots by Identifier and Senders.

NOTE

Due to certain limitations with the Luau Type System, iterating over the QueryResult Object will not return typed values. In order to fix this, call :__iter() on the QueryResult Object.

For example:

for i, sender, ... in net:query():__iter() do
	-- Do something
end

See Querying Data for more information.

Functions

iterating over QueryResult

for  number, Player | string, ...any  in  QueryResult  do

Iterating over a QueryResult will return the Packets in the QueryResult's Snapshot that match the supplied Senders from QueryResult:from.

Usage:

for pos, sender, ... in net:query():from(...senders) do
	-- Do something
end

from

QueryResult:from(
senders...sender--

The Senders to filter

) → QueryResult

Filters Packets from the QueryResult's Snapshot based on the provided Senders.

Show raw api
{
    "functions": [
        {
            "name": "__iter",
            "desc": "Iterating over a QueryResult will return the Packets in the QueryResult's Snapshot that\nmatch the supplied Senders from [QueryResult:from].\n\nUsage:\n```lua\nfor pos, sender, ... in net:query():from(...senders) do\n\t-- Do something\nend\n```",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "desc": "",
                    "lua_type": "Player | string"
                },
                {
                    "desc": "",
                    "lua_type": "...any"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 79,
                "path": "lib/QueryResult.luau"
            }
        },
        {
            "name": "from",
            "desc": "Filters Packets from the QueryResult's Snapshot based on the provided Senders.",
            "params": [
                {
                    "name": "senders",
                    "desc": "The Senders to filter",
                    "lua_type": "...sender"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "QueryResult"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 124,
                "path": "lib/QueryResult.luau"
            }
        },
        {
            "name": "new",
            "desc": "Creates a new QueryResult with the supplied Snapshot.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "QueryResult"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 151,
                "path": "lib/QueryResult.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "QueryResult",
    "desc": "An iterable object returned as the result of [Route:query] that can filter snapshots\nby Identifier and Senders.\n\n:::note\nDue to certain limitations with the Luau Type System, iterating over the QueryResult Object\nwill not return typed values. In order to fix this, call ``:__iter()`` on the QueryResult Object.\n\nFor example:\n```lua\nfor i, sender, ... in net:query():__iter() do\n\t-- Do something\nend\n```\n:::\n\nSee [Querying Data](/docs/getting-started/routes#querying) for more information.",
    "since": "v0.4.0",
    "source": {
        "line": 39,
        "path": "lib/QueryResult.luau"
    }
}