Skip to content
ConcordConcordConcord

Entity:ensure

Ensures an Entity has a Component.

← Entity

Ensures an Entity has a Component.

If the Component already exists, no action is taken.

entity = entity:ensure( name, ... )
Name Type Description
name string Name of the ComponentClass
... any Additional arguments to pass to the Component’s populate function
Name Type Description
entity Entity

entity = entity:ensure( component )

Pass an existing Component instance (already populated, not attached to an entity). Skips name and populate arguments.

Name Type Description
component Component
Name Type Description
entity Entity