From ce70b1b2ee478fd72e01040d59d94237fa3d6b8b Mon Sep 17 00:00:00 2001 From: Mark Marks Date: Thu, 29 Aug 2024 18:24:54 +0200 Subject: [PATCH] chore: Expose world:contains and query:drain in types --- src/init.luau | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/init.luau b/src/init.luau index bbb3393..3898676 100644 --- a/src/init.luau +++ b/src/init.luau @@ -921,9 +921,8 @@ function world_delete(world: World, entity: i53) entityIndex.sparse[entity] = nil end -local function world_contains(world: World, entity) - - return world.entityIndex.sparse[entity] +local function world_contains(world: World, entity): boolean + return world.entityIndex.sparse[entity] ~= nil end type CompatibleArchetype = { archetype: Archetype, indices: { number } } @@ -1541,6 +1540,9 @@ export type World = { parent: (self: World, entity: Entity) -> Entity, + --- Checks if the world contains the given entity + contains: (self: World, entity: Entity) -> boolean, + --- Searches the world for entities that match a given query query: ((self: World, Id) -> Query) & ((self: World, Id, Id) -> Query)