Function ecs_term_w_size

Synopsis

#include <include/flecs.h>

FLECS_API void * ecs_term_w_size(const ecs_iter_t *it, size_t size, int32_t index)

Description

Obtain data for a query term. This operation retrieves a pointer to an array of data that belongs to the term in the query. The index refers to the location of the term in the query, and starts counting from one.

For example, the query "Position, Velocity" will return the Position array for index 1, and the Velocity array for index 2.

When the specified term is not owned by the entity this function returns a pointer instead of an array. This happens when the source of a term is not the entity being iterated, such as a shared component (from a prefab), a component from a parent, or another entity. The ecs_term_is_owned operation can be used to test dynamically if a term is owned.

The provided size must be either 0 or must match the size of the datatype of the returned array. If the size does not match, the operation may assert. The size can be dynamically obtained with ecs_term_size.

Parameters

it - The iterator.

size - The size of the returned array.

index - The index of the term in the query.

Returns
A pointer to the data associated with the term.

Source

Line 2925 in include/flecs.h.