mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
Fix typo
This commit is contained in:
parent
c7be8958ef
commit
4e21367caf
1 changed files with 9 additions and 5 deletions
|
@ -89,7 +89,7 @@ world
|
||||||
|
|
||||||
### archetypes()
|
### archetypes()
|
||||||
```luau
|
```luau
|
||||||
function query:archetypes(): { Archetype }
|
function query.archetypes(): { Archetype }
|
||||||
```
|
```
|
||||||
Returns the matching archetypes of the query.
|
Returns the matching archetypes of the query.
|
||||||
|
|
||||||
|
@ -97,12 +97,16 @@ Example:
|
||||||
::: code-group
|
::: code-group
|
||||||
|
|
||||||
```luau [luau]
|
```luau [luau]
|
||||||
for i, archetype in world:query(Position, Velocity):archetypes() do
|
for i, archetype in world:query(Position, Velocity).archetypes() do
|
||||||
local field = archetype.records
|
|
||||||
local columns = archetype.columns
|
local columns = archetype.columns
|
||||||
|
local field = archetype.records
|
||||||
|
|
||||||
|
local P = field[Position]
|
||||||
|
local V = field[Velocity]
|
||||||
|
|
||||||
for row, entity in archetype.entities do
|
for row, entity in archetype.entities do
|
||||||
local position = columns[field[Position]][row]
|
local position = columns[P][row]
|
||||||
local velocity = columns[field[Velocity]][row]
|
local velocity = columns[V][row]
|
||||||
-- Do something
|
-- Do something
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue