diff --git a/lib/World.d.ts b/lib/World.d.ts index ffa4caa..84cb175 100644 --- a/lib/World.d.ts +++ b/lib/World.d.ts @@ -118,6 +118,17 @@ export class World { * @param only - The component to fetch * @returns Returns the component values in the same order they were passed to. * @remarks + * Component value returned is nullable if it isn't associated with the entity (in real-time). + */ + public get(entity: AnyEntity, only: T): ReturnType | undefined; + + /** + * Gets multiple components from a specific entity in this world. + * + * @param entity - The entity ID + * @param bundle - The components to fetch + * @returns Returns the component values in the same order they were passed to. + * @remarks * Component values returned are nullable if the components used to search for aren't associated with the entity (in real-time). */ public get(entity: AnyEntity, ...bundle: T): LuaTuple>>; @@ -236,21 +247,21 @@ type QueryResult = Query & { This is used for many repeated random access to an entity. If you only need to iterate, just use a query. ```ts - local inflicting = world:query(Damage, Hitting, Player):view() - for (const [_, source] of world.query(DamagedBy)) {} - local damage = inflicting:get(source.from) - end + const inflicting = world.query(Damage, Hitting, Player).view() + for (const [_, source] of world.query(DamagedBy)) { + const damage = inflicting.get(source.from) + } - for _ in world:query(Damage):view() do end -- You can still iterate views if you want! + for (const [, damage] of world.query(Damage).view()) {} -- You can still iterate views if you want! ``` @returns View See [View](/api/View) docs. */ - view: View; + view: () => View; }; type View = Query & { - get: (this: View, id: AnyEntity) => LuaTuple; + get: (this: View, id: AnyEntity) => LuaTuple>; contains: (this: View) => boolean; };