Function ecs_table_insert


#include <include/flecs.h>

FLECS_API ecs_record_t ecs_table_insert(ecs_world_t *world, ecs_table_t *table, ecs_entity_t entity, ecs_record_t *record)


Insert record into table. This will create a new record for the table, which inserts a value for each component. An optional entity and record can be provided.

If a non-zero entity id is provided, a record must also be provided and vice versa. The record must be created by the entity index. If the provided record is not created for the specified entity, the behavior will be undefined.

If the provided record is not managed by the entity index, the behavior will be undefined.

The returned record contains a reference to the table and the table row. The data pointed to by the record is guaranteed not to move unless one or more rows are removed from this table. A row can be removed as result of a delete, or by adding/removing components from an entity stored in the table.


world - The world.

table - The table.

entity - The entity.

record - The entity-index record for the specified entity.

A record containing the table and table row.


Line 2910 in include/flecs.h.