Skip to main content

View

Provides random access to the results of a query.

Calling the View is equivalent to iterating a query.

for id, player, health, poison in world:query(Player, Health, Poison):view() do
	-- Do something
end

Functions

get

View:get(entitynumber-theentityID) → ...ComponentInstance
Retrieve the query results to corresponding `entity`

contains

View:contains(entitynumber-theentityID) → boolean

Equivalent to world:contains()

Show raw api
{
    "functions": [
        {
            "name": "get",
            "desc": "\tRetrieve the query results to corresponding `entity`\n\t",
            "params": [
                {
                    "name": "entity",
                    "desc": "",
                    "lua_type": "number - the entity ID"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "...ComponentInstance"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 813,
                "path": "lib/World.luau"
            }
        },
        {
            "name": "contains",
            "desc": "Equivalent to `world:contains()`\n\t",
            "params": [
                {
                    "name": "entity",
                    "desc": "",
                    "lua_type": "number - the entity ID"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 827,
                "path": "lib/World.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "View",
    "desc": "Provides random access to the results of a query.\n\nCalling the View is equivalent to iterating a query.\n\n```lua\nfor id, player, health, poison in world:query(Player, Health, Poison):view() do\n\t-- Do something\nend\n```",
    "source": {
        "line": 720,
        "path": "lib/World.luau"
    }
}