This commit is contained in:
Laptev Stanislav 2025-08-03 12:01:12 +03:00 committed by GitHub
commit 99da6b9a77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -355,46 +355,9 @@ This operation is the same as calling:
world:target(entity, jecs.ChildOf, 0)
```
## contains
Checks if an entity or component (id) exists in the world.
```luau
function World:contains(
entity: Entity,
): boolean
```
Example:
::: code-group
```luau [luau]
local entity = world:entity()
print(world:contains(entity))
print(world:contains(1))
print(world:contains(2))
-- Outputs:
-- true
-- true
-- false
```
```ts [typescript]
const entity = world.entity();
print(world.contains(entity));
print(world.contains(1));
print(world.contains(2));
// Outputs:
// true
// true
// false
```
:::
## remove
Removes a component (ID) from an entity
@ -460,11 +423,11 @@ Example:
```luau [luau]
local entity = world:entity()
print(world:has(entity))
print(world:contains(entity))
world:delete(entity)
print(world:has(entity))
print(world:contains(entity))
-- Outputs:
-- true
@ -601,7 +564,7 @@ print(retrievedParent === parent) // true
## contains
Checks if an entity exists and is alive in the world.
Checks if an entity or component (id) exists and is alive in the world.
```luau
function World:contains(