Entity:is_valid
Returns whether this entity is still in play (ie. not despawned). See Entity:despawn for more details.
Usage
entity:is_valid()
Returns
| Name | Type | Description |
|---|---|---|
valid | boolean | False if this entity has been despawned, true otherwise. |
Examples
local ecs = crystal.ECS:new();
local entity = ecs:spawn(crystal.Entity);
assert(entity:is_valid());
entity:despawn();
assert(not entity:is_valid());