Builtin Library
- ..
- .metadata195 B
- README.md1.9 KB
- init.luau2.4 KB
- query.module
README.md
scene.query (procNode)
Entity ids out of the live scene: by name, by a component they carry, as the children, descendants or parent of other
entities, or the camera the scene is seen through. Queries compose: of and within take another query's ids. Wire
the ids into scene.fetch to bring the entities into the graph as points.
Inputs
by(String, default"name"): how entities are found:"name"byname;"component"by the componentcomponentnames;"children","descendants"or"parent"of the entities inof;"camera"the camera the scene is seen through (no ids when there is none).name(String, default""): the Name to find, or a glob over Names (*any run,?any one character). Read whenbyis"name"; empty there is refused.component(String, default""): the component the entities carry, native ("Light") or script. Read whenbyis"component"; empty there is refused.of(List<Entity>, optional): the entities whose children, descendants or parent are found: ids, Names, or another query's ids. A single reference is a list of one. Read, and required non-empty, whenbyis"children","descendants"or"parent".within(List<Entity>, optional): keep only these entities of what is found, so one query narrows another.order(String, default"scene"):"scene"keeps the order the scene holds them in;"name"sorts them by Name, ties by id.
A reference in of or within that names no entity in the scene is refused, naming it. An entity found twice (the
same child of two parents) is listed once.
Outputs
A call answers a record by output name.
ids(Entity[]): the entity ids found.count(Int): how many.
Example
local lamps = g.scene.query({ by = "component", component = "Light", order = "name" })
local points = g.scene.fetch({ ids = lamps.ids, components = { "Light" } })