mirror of
https://github.com/Ukendio/jecs.git
synced 2025-08-04 03:09:18 +00:00
Compare commits
3 commits
3e46b723e9
...
998b1d3528
Author | SHA1 | Date | |
---|---|---|---|
|
998b1d3528 | ||
|
0606bf70f0 | ||
|
f2a803c0d8 |
2 changed files with 8 additions and 3 deletions
|
@ -13,6 +13,8 @@ function Query:cached(): Query -- Returns the cached Query
|
|||
```
|
||||
Example:
|
||||
|
||||
::: code-group
|
||||
|
||||
```luau [luau]
|
||||
local lerps = world:query(Lerp):cached() -- Ensure that you cache this outside a system so you do not create a new cache for a query every frame
|
||||
|
||||
|
@ -31,6 +33,9 @@ function system(dt) {
|
|||
// Do something
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## with
|
||||
|
||||
|
@ -142,4 +147,4 @@ local iterator = query:iter()
|
|||
for entity, position, velocity in iterator do
|
||||
-- Process entity
|
||||
end
|
||||
```
|
||||
```
|
||||
|
|
4
jecs.d.ts
vendored
4
jecs.d.ts
vendored
|
@ -156,8 +156,8 @@ export class World {
|
|||
* @param hook The hook to install.
|
||||
* @param value The hook callback.
|
||||
*/
|
||||
set<T>(component: Entity<T>, hook: StatefulHook, value: (e: Entity<T>, id: Id<T>, data: T) => void): void;
|
||||
set<T>(component: Entity<T>, hook: StatelessHook, value: (e: Entity<T>, id: Id<T>) => void): void;
|
||||
set<T>(component: Entity<T>, hook: StatefulHook, value: (e: Entity, id: Id<T>, data: T) => void): void;
|
||||
set<T>(component: Entity<T>, hook: StatelessHook, value: (e: Entity, id: Id<T>) => void): void;
|
||||
/**
|
||||
* Assigns a value to a component on the given entity.
|
||||
* @param entity The target entity.
|
||||
|
|
Loading…
Reference in a new issue