ScriptQueryBuilder

The query builder is used to build queries for entities with specific components. Can be used to interact with arbitrary entities in the world.

component

Adds a component to the query, this will be accessible in the query results under the index corresponding to the index of this component in the query.

Arguments:

ArgumentTypeDescription
sScriptQueryBuilderThe query builder
componentScriptTypeRegistrationThe component to query for

Returns:

ReturnDescription
ScriptQueryBuilderThe updated query builder
query:component(MyType):component(MyOtherType)

with

Arguments:

ArgumentTypeDescription
sScriptQueryBuilderThe query builder
withScriptTypeRegistrationThe component to include in the query

Returns:

ReturnDescription
ScriptQueryBuilderThe updated query builder
query:with(MyType):with(MyOtherType)

without

Arguments:

ArgumentTypeDescription
sScriptQueryBuilderThe query builder
withoutScriptTypeRegistrationThe component to exclude from the query

Returns:

ReturnDescription
ScriptQueryBuilderThe updated query builder
query:without(MyType):without(MyOtherType)

build

Arguments:

ArgumentTypeDescription
sScriptQueryBuilderThe query builder

Returns:

ReturnDescription
Vec<ScriptQueryResult>The query results
local results = query:build()
for _, result in pairs(results) do
    print(result)
end