mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
Update query.md
This commit is contained in:
parent
561a3a77de
commit
27235382c9
1 changed files with 0 additions and 18 deletions
|
@ -104,7 +104,6 @@ function query.archetypes(): { Archetype }
|
|||
|
||||
Example:
|
||||
|
||||
::: code-group
|
||||
```luau [luau]
|
||||
for i, archetype in world:query(Position, Velocity).archetypes() do
|
||||
local columns = archetype.columns
|
||||
|
@ -121,23 +120,6 @@ for i, archetype in world:query(Position, Velocity).archetypes() do
|
|||
end
|
||||
```
|
||||
|
||||
```ts [typescript]
|
||||
for (const [i, archetype] of world.query(Position, Velocity).archetypes()) {
|
||||
const columns = archetype.columns;
|
||||
const field = archetype.records;
|
||||
|
||||
const P = field[Position];
|
||||
const V = field[Velocity];
|
||||
|
||||
for (const [row, entity] of archetype.entities) {
|
||||
local position = columns[P][row];
|
||||
local velocity = columns[V][row];
|
||||
// Do something
|
||||
}
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
:::info
|
||||
This function is meant for internal usage. Use this if you want to maximize performance by inlining the iterator.
|
||||
:::
|
||||
|
|
Loading…
Reference in a new issue