Function ecs_commit


#include <include/flecs.h>

FLECS_API bool ecs_commit(ecs_world_t *world, ecs_entity_t entity, ecs_record_t *record, ecs_table_t *table, const ecs_type_t *added, const ecs_type_t *removed)


Commit (move) entity to a table. This operation moves an entity from its current table to the specified table. This may cause the following actions:

  • Ctor for each component in the target table
  • Move for each overlapping component
  • Dtor for each component in the source table.
  • OnAdd triggers for non-overlapping components in the target table
  • OnRemove triggers for non-overlapping components in the source table.

This operation is a faster than adding/removing components individually.

The application must explicitly provide the difference in components between tables as the added/removed parameters. This can usually be derived directly from the result of ecs_table_add_id and esc_table_remove_id. These arrays are required to properly execute OnAdd/OnRemove triggers.


world - The world.

entity - The entity to commit.

record - The entity's record (optional, providing it saves a lookup).

table - The table to commit the entity to.

True if the entity got moved, false otherwise.


Line 4720 in include/flecs.h.