Skip to content
SinisterRectus edited this page Nov 6, 2016 · 17 revisions

Enhanced Lua table that is used to store Discord objects of the same type.

Class Properties

Name Type Mutable Description
count number How many objects are cached

Class Methods

Prototype Description
add(obj) Adds an object to the cache. Must match the defined type.
find(predicate) Returns the first object found that satisfies a predicate.
findAll(predicate) Returns an iterator for all objects that satisfy a predicate.
get([key,] value) Returns the first object that matches provided (key, value) pair.
getAll([key, value]) Returns an iterator for all objects that match the (key, value) pair.
has(obj) Returns a boolean indicating whether the cache contains the specified object.
iter() Returns an iterator for the objects in the queue. Order is not guaranteed.
keys() Returns an array-like Lua table of all of the cached objects' keys, sorted by key.
merge(array) Adds many new Discord object from an array of JSON data tables.
new(data) Adds a new Discord object from a JSON data table and returns the object.
remove(obj) Remove an object from the cache. Must match the defined type.
values() Returns an array-like Lua table of all of the cached objects, sorted by key.
Clone this wiki locally