Update some (doc) comments

main
copygirl 8 months ago
parent 85fa141d4d
commit 1629281168
  1. 2
      src/context.zig
  2. 32
      src/id.zig
  3. 2
      src/path.zig

@ -101,6 +101,8 @@ pub fn Context(comptime ctx: anytype) type {
try lookupAndRegisterDeclarations(world, root, flecs, error_writer); try lookupAndRegisterDeclarations(world, root, flecs, error_writer);
} }
/// Registers type lookups for the builtin Flecs entities, but limited
/// to the `flecs.core` namespace. This is used by `World.initMinimal()`.
pub fn registerFlecsCoreLookups(world: *World) !void { pub fn registerFlecsCoreLookups(world: *World) !void {
const error_writer = std.io.getStdErr().writer(); const error_writer = std.io.getStdErr().writer();
const flecs = @import("./builtin/flecs.zig"); const flecs = @import("./builtin/flecs.zig");

@ -97,10 +97,10 @@ pub fn Id(comptime ctx: anytype) type {
/// That is, a component without data / size. /// That is, a component without data / size.
/// ///
/// An `Id` is a tag when it .. /// An `Id` is a tag when it ..
/// - .. is an entity without the `EcsComponent` component. /// - .. is an entity without the `Component` component.
/// - .. has an `EcsComponent` with size member set to 0. /// - .. has an `Component` with size member set to 0.
/// - .. is a `Pair` where both elements are a tag. /// - .. is a `Pair` where both elements are a tag.
/// - .. is a `Pair` where `.relation` has the `EcsTag` tag. /// - .. is a `Pair` where `.relation` has the `Tag` tag.
pub fn isTag(self: Self) bool { pub fn isTag(self: Self) bool {
return c.ecs_id_is_tag(self.world.raw, self.raw); return c.ecs_id_is_tag(self.world.raw, self.raw);
} }
@ -109,14 +109,17 @@ pub fn Id(comptime ctx: anytype) type {
/// Only `Pair`s can be unions. /// Only `Pair`s can be unions.
/// ///
/// An `Id` represents a union when .. /// An `Id` represents a union when ..
/// - .. the `.relation` of the pair is `EcsUnion`. /// - .. the `.relation` of the pair is `Union`.
/// - .. the `.relation` of the pair has `EcsUnion`. /// - .. the `.relation` of the pair has `Union`.
pub fn isUnion(self: Self) bool { pub fn isUnion(self: Self) bool {
return c.ecs_id_is_union(self.world.raw, self.raw); return c.ecs_id_is_union(self.world.raw, self.raw);
} }
/// Returns whether this `Id` is in use in the world. /// Returns whether this `Id` is in use in the world.
/// That is, if it has been added to one or more tables. /// That is, if it has been added to one or more tables.
///
/// Note that empty tables may reference this `Id`, in which case
/// this function can return `true`. Consider using `count()` instead.
pub fn isInUse(self: Self) bool { pub fn isInUse(self: Self) bool {
return c.ecs_id_in_use(self.world.raw, self.raw); return c.ecs_id_in_use(self.world.raw, self.raw);
} }
@ -127,26 +130,25 @@ pub fn Id(comptime ctx: anytype) type {
} }
// Get the type for an id. // Get the type for an id.
// This function returnsthe type information for an id. The specified id can be // This function returns the type information for an id. The specified id can be
// any valid id. For the rules on how type information is determined based on // any valid id. For the rules on how type information is determined based on
// id, see ecs_get_typeid. // id, see ecs_get_typeid.
// TODO: const ecs_type_info_t* ecs_get_type_info(const ecs_world_t *world, ecs_id_t id); // TODO: const ecs_type_info_t* ecs_get_type_info(const ecs_world_t *world, ecs_id_t id);
/// Attempts to get the component type for this `Id`. /// Returns the entity representing the component type for this `Id`,
/// if it is associated with a type, or `null` otherwise.
/// ///
/// This operation returns the entity representing the component type /// For a regular component with a non-zero size (an entity with the
/// for this `Id`, if it is associated with a type. For a regular /// `flecs.core.Component` component) the operation will return the
/// component with a non-zero size (an entity with the `EcsComponent` /// entity itself.
/// component) the operation will return the `Entity` itself.
/// ///
/// For an entity that does not have the `EcsComponent` component, or /// For an entity that does not have the `Component` component, or
/// with an `EcsComponent` value with size 0, the operation will /// its component is zero-sized, the operation will return `null`.
/// return `null`.
/// ///
/// For a `Pair`, the operation will return the type associated with /// For a `Pair`, the operation will return the type associated with
/// the pair, by applying the following rules in order: /// the pair, by applying the following rules in order:
/// - If `.relation` is a component, it is returned. /// - If `.relation` is a component, it is returned.
/// - If `.relation` has the `Tag` property, `null` is returned. /// - If `.relation` has `flecs.core.Tag`, `null` is returned.
/// - If `.target` is a component, it is returned. /// - If `.target` is a component, it is returned.
/// - Otherwise, `null` is returned. /// - Otherwise, `null` is returned.
pub fn typeId(self: Self) ?Entity { pub fn typeId(self: Self) ?Entity {

@ -370,7 +370,7 @@ test Path {
// When handling paths, always be aware of the lifetime of its array and // When handling paths, always be aware of the lifetime of its array and
// any string parts contained within it. This API allows you to completely // any string parts contained within it. This API allows you to completely
// avoid allocation if you know what you are doing. // avoid allocation if you know what you are doing.
// In the above example, `absolute_parts` is an array allocated onto the // In the above example, `absolute1_parts` is an array allocated onto the
// stack, and as such will only be valid until the end of the scope. This // stack, and as such will only be valid until the end of the scope. This
// means no allocation is necessary, but it also means `absolute1` is only // means no allocation is necessary, but it also means `absolute1` is only
// valid for as long as its parts are. // valid for as long as its parts are.

Loading…
Cancel
Save