ArrayIterable - truemedian/Discordia GitHub Wiki
Inherits Iterable
Iterable class that contains objects in a constant, ordered fashion, although the order may change if the internal array is modified. Some versions may use a map function to shape the objects before they are accessed.
Inherited from Iterable
get
find
findAll
forEach
random
count
toArray
select
Returns an iterator that returns all contained objects in a consistent order.
Returns: function
Inherited from Iterable
Returns an individual object by key, where the key should match the result of calling
__hash
on the contained objects. Operates with up to O(n) complexity.
Name Type k * Returns: *
Returns the first object that satisfies a predicate.
Name Type fn function Returns: *
Returns an iterator that returns all objects that satisfy a predicate.
Name Type fn function Returns: function
Iterates through all objects and calls a function
fn
that takes the objects as an argument.
Name Type fn function Returns: nil
Returns a random object that is contained in the iterable.
Returns: *
Returns the amount of objects that satisfy a predicate.
Name Type fn function Returns: number
Returns a sequentially-indexed table that contains references to all objects. If a
sortBy
string is provided, then the table is sorted by that particular property. If a predicate is provided, then only objects that satisfy it will be included.
Name Type Optional Optional sortBy string x fn function x Returns: table
Similarly to an SQL query, this returns a sorted Lua table of rows where each row corresponds to each object in the iterable, and each value in the row is selected from the objects according to the arguments provided.
Name Type ... * Returns: table
Returns the first object in the array
**Type: ***
Returns the last object in the array
**Type: ***