Class l2df.manager.group

Last updated 2021-05-28 15:24:22

Grouping manager.

Can be used for classification, filtering or querying of the created entities / objects.

Info:

Functions

Manager:init([kwargs]) Configure GroupManager.
Manager:classInit(entity) Embed references to GroupManager's methods in the entity instance that you create.
Manager:getByClass(class) Returns all objects that are instances of the class.
Manager:getByInstance(class) Returns all objects that are heirs of the class.
Manager.addTags(self[, tags]) Add tags to the object.
Manager.removeTags(self[, tags]) Remove tags from the object.
Manager.getTags(self) Gets a list of object's tags.
Manager.hasTags(self[, tags]) Checks if an object has tags.
Manager:getByTag(tag) Returns a list of objects that contain the specified tag.
Manager:getByFilter([tags[, filter]]) Returns a list of objects that satisfy the filter.


Functions

Methods
Manager:init([kwargs])
Configure GroupManager. Currently does nothing.

Parameters:

  • kwargs table Keyword arguments. Not actually used. (optional)

Returns:

    l2df.manager.group
Manager:classInit(entity)
Embed references to GroupManager's methods in the entity instance that you create. Also adds created entity's instance to the list of known classes. Embedded methods are: addTags, removeTags, hasTags and getTags.

Parameters:

Manager:getByClass(class)
Returns all objects that are instances of the class.

Parameters:

  • class l2df.class Class of the entity that was used to create it.

Returns:

    {l2df.class.entity,...} The list of entities.
Manager:getByInstance(class)
Returns all objects that are heirs of the class.

Parameters:

  • class l2df.class Entity's class or its predecessor.

Returns:

    {l2df.class.entity,...} The list of entities.
Manager.addTags(self[, tags])
Add tags to the object.

Parameters:

  • self table or l2df.class.entity Object to attach tags.
  • tags {mixed,...} or mixed Tag or array of tags to add. Can be of any hashable type (in other words not userdata). (optional)
Manager.removeTags(self[, tags])
Remove tags from the object.

Parameters:

  • self table or l2df.class.entity Object to remove tags from.
  • tags {mixed,...} or mixed Tag or array of tags to remove. (optional)
Manager.getTags(self)
Gets a list of object's tags.

Parameters:

Returns:

    {mixed,...} The list of found tags.
Manager.hasTags(self[, tags])
Checks if an object has tags.

Parameters:

  • self table Object to check.
  • tags {mixed,...} or mixed Tag or array of tags to check for existence. (optional)
Manager:getByTag(tag)
Returns a list of objects that contain the specified tag.

Parameters:

  • tag mixed Can be of any hashable type (in other words not userdata).

Returns:

    {l2df.class.entity,...} The list of entities.
Manager:getByFilter([tags[, filter]])
Returns a list of objects that satisfy the filter.

Parameters:

  • tags {mixed,...} or mixed Tag or array of tags to check for existence. (optional)
  • filter function Filter function accepts the only argumenty - entity instance. (optional)

Returns:

    {l2df.class.entity,...} The list of entities.