diff --git a/src/jecs.d.ts b/src/jecs.d.ts index e2de9d6..7b113df 100755 --- a/src/jecs.d.ts +++ b/src/jecs.d.ts @@ -155,6 +155,14 @@ export class World { */ target(entity: Entity, relation: Entity, index?: number): Entity | undefined; + /** + * Gets an iterator for all targets of a relationship. + * Returns an empty iterator if no matches are found. + * @param entity The entity using a relationship pair. + * @param relation The "relationship" component/tag + */ + targets(entity: Entity, relation: Entity): IterFn<[]> + /** * Deletes an entity (and its components/relationships) from the world entirely. * @param entity The entity to delete. diff --git a/src/jecs.luau b/src/jecs.luau index 453bc88..a8cb226 100755 --- a/src/jecs.luau +++ b/src/jecs.luau @@ -254,7 +254,8 @@ export type World = { index: number? ) -> Entity?, - -- Gets an iterator for all viable targets of a relationship + -- Gets an iterator for all targets of a relationship. + -- Returns an empty iterator if no matches are found. targets: ( self: World, id: Entity | number,