document c types

This commit is contained in:
2025-02-09 00:00:40 -06:00
parent 95c64f51de
commit 7cffdab28a
89 changed files with 4133 additions and 1390 deletions

View File

@@ -1,77 +1,87 @@
# actor
# actor
A set of utilities for iterating over a hierarchy of actor-like objects, as well
as managing tag-based lookups. Objects are assumed to have a "objects" property,
pointing to children or sub-objects, forming a tree.
pointing to children or sub-objects, forming a tree.
## all_objects(fn, startobj)
### all_objects(fn, startobj)
Iterate over each object (and its sub-objects) in the hierarchy, calling fn for each one.
**fn**: A callback function that receives each object. If it returns a truthy value, iteration stops and that value is returned.
**startobj**: The root object at which iteration begins, default is the global "world".
**Returns**: The first truthy value returned by fn, or undefined if none.
Iterate over each object (and its sub-objects) in the hierarchy, calling fn for each one.
### find_object(fn, startobj)
## find_object(fn, startobj)
Intended to find a matching object within the hierarchy.
**fn**: A callback or criteria to locate a particular object.
**startobj**: The root object at which search begins, default "world".
**Returns**: Not yet implemented.
Intended to find a matching object within the hierarchy.
**Returns**: Not yet implemented.
## tag_add(tag, obj)
### tag_add(tag, obj)
Associate the given object with the specified tag. Creates a new tag set if it does not exist.
**tag**: A string tag to associate with the object.
**obj**: The object to add under this tag.
**Returns**: None
Associate the given object with the specified tag. Creates a new tag set if it does not exist.
### tag_rm(tag, obj)
## tag_rm(tag, obj)
Remove the given object from the specified tags set, if it exists.
**tag**: The tag to remove the object from.
**obj**: The object to remove from the tag set.
**Returns**: None
Remove the given object from the specified tags set, if it exists.
## tag_clear_guid(obj)
**obj**: The object whose tags should be cleared.
**Returns**: None
### tag_clear_guid(obj)
Remove the object from all tag sets.
## objects_with_tag(tag)
**obj**: The object whose tags should be cleared.
**Returns**: None
### objects_with_tag(tag)
Retrieve all objects currently tagged with the specified tag.
**tag**: A string tag to look up.
**Returns**: An array of objects associated with the given tag.
Retrieve all objects currently tagged with the specified tag.
**Returns**: An array of objects associated with the given tag.