Compare commits

..

3 commits

Author SHA1 Message Date
EncodedVenom
998b1d3528
Update query.md - formatting
Some checks are pending
analysis / Run Luau Analyze (push) Waiting to run
deploy-docs / build (push) Waiting to run
deploy-docs / Deploy (push) Blocked by required conditions
publish-npm / publish (push) Waiting to run
unit-testing / Run Luau Tests (push) Waiting to run
2025-07-26 18:55:38 -04:00
EncodedVenom
0606bf70f0
Merge pull request #258 from daimond113/fix/remove-entity-type-generic
Remove data generic from entity in hooks
2025-07-26 18:48:23 -04:00
daimond113
f2a803c0d8
Remove data generic from entity in hooks 2025-07-27 00:13:14 +02:00
2 changed files with 8 additions and 3 deletions

View file

@ -13,6 +13,8 @@ function Query:cached(): Query -- Returns the cached Query
``` ```
Example: Example:
::: code-group
```luau [luau] ```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 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 // Do something
} }
} }
```
:::
## with ## with

4
jecs.d.ts vendored
View file

@ -156,8 +156,8 @@ export class World {
* @param hook The hook to install. * @param hook The hook to install.
* @param value The hook callback. * @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: StatefulHook, value: (e: Entity, 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: StatelessHook, value: (e: Entity, id: Id<T>) => void): void;
/** /**
* Assigns a value to a component on the given entity. * Assigns a value to a component on the given entity.
* @param entity The target entity. * @param entity The target entity.