API reference
API reference
Select your platform
No SDKs available
No versions available

Query

Query

class Query
A class representing a query.

Types

NameSummary
Companion
object Companion

Properties

NameSummary
prev_
var prev_: Query?
query_
var query_: IntArray

Functions

NameSummary
eval
fun eval(): <Error class: unknown class><Entity>
Evaluates the query and returns a sequence of entities that match the query.
fun eval(dm: DataModel): <Error class: unknown class><Entity>
Evaluates the query for a specific DataModel and returns a sequence of entities that match the query.
registerEventListener
fun <T : EventArgs> registerEventListener(eventName: String, listener: (entity: Entity, eventArgs: T) -> Unit): QueryEventListenerManager<T>
Registers an event listener for a specific event on entities that match the query.
with
fun with(componentTypes: IntArray): Query
fun with(componentType: Int): Query

Companion

object Companion

Functions

NameSummary
and
fun and(vararg items: IntArray): IntArray
Performs a logical AND operation on multiple queries.
changed
fun changed(vararg componentTypes: Int): IntArray
Creates a query that checks if an entity has a specific component that has changed in the last tick.
has
fun has(vararg componentTypes: Int): IntArray
Creates a query that checks if an entity has a specific components.
or
fun or(vararg items: IntArray): IntArray
Performs a logical OR operation on multiple queries.
query
fun query(code: IntArray): Query
where
fun where(initializer: QueryBuilder.() -> Unit): Query
DSL for building queries, e.g.: val query = Query.where { has(1, 2, 3) and changed(4, 5) }
Did you find this page helpful?
Thumbs up icon
Thumbs down icon