Internationalisation
Bundled Plugins API
ElementCache
Provides caching for Element subclasses that want to cache children.

API Overview

API Documentation

Constructors

Signature
cp.ui.ElementCache(parent[, createFn])
Type
Constructor
Description
Creates and returns a new ElementCache, with the specified parent and function which
Parameters
  • parent - the parent Element that contains the cached items.
  • createFn - a function that will create new Element subclasses based on cached axuielement values.
Returns
  • The new ElementCache.

Methods

Signature
cp.ui.ElementCache:cachedElement(cache, ui) -> cp.ui.Element or nil
Type
Method
Description
Returns the cached Element, if it is present.
Parameters
  • ui - The axuielement it is linked to. If not provided, it will be fetched by calling Element:UI().
Returns
  • cp.ui.Element or nil
Signature
cp.ui.ElementCache:cacheElement(element[, ui]) -> none
Type
Method
Description
Caches the provided Element.
Parameters
  • element - The Element
  • ui - The axuielement it is linked to. If not provided, it will be fetched by calling Element:UI().
Returns
  • None

clean

Signature
cp.ui.ElementCache:clean()
Type
Method
Description
Clears the cache of any invalid (aka dead) items.
Parameters
  • None
Returns
  • None
Signature
cp.ui.ElementCache:fetchElement(ui) -> cp.ui.Element or nil
Type
Method
Description
Retrieves the matching Element instance from the cache.
Parameters
  • ui - The axuielement being fetched for.
Returns
  • cp.ui.Element or nil
Signature
cp.ui.ElementCache:fetchElements(uis) -> table of cp.ui.Elements or nil
Type
Method
Description
Fetches a list of Element instances linked to the provided axuielement list.
Parameters
  • uis - A table of axuielement values.
Returns
Notes
  • If any of the provided axuielement values are either not from the parent, or no longer valid, a nil value will be stored in the matching index. Note that in that case, this will break useage of ipairs due to leaving holes in the list.

reset

Signature
cp.ui.ElementCache:reset() -> none
Type
Method
Description
Removes all cached items from the cache.
Parameters
  • None
Returns
  • None
Last modified 1mo ago