operator [] method

T? operator [](
  1. int entity
)

Fast and safe retrieval of a component for this entity. If the entity does not have this component then null is returned.

Implementation

T? operator [](int entity) {
  if (_components.length > entity) {
    return _components[entity];
  }
  return null;
}