-
Notifications
You must be signed in to change notification settings - Fork 144
TableIterable
extends Iterable
Iterable class that wraps a basic Lua table, where order is not guaranteed. Some versions may use a map function to shape the objects before they are accessed.
Instances of this class should not be constructed by users.
Methods Inherited From Iterable
Defines the behavior of the
#
operator. Returns the total number of objects stored in the iterable.Returns: function
Defines the behavior of the
pairs
function. Returns an iterator that returns akey, value
pair, wherekey
is the result of calling__hash
on thevalue
.Returns: function
Parameter Type Optional fn function ✔ If a predicate is provided, this returns the number of objects in the iterable that satistfy the predicate; otherwise, the total number of objects.
Returns: number
Parameter Type fn function Returns the first object that satisfies a predicate.
Returns: *
Parameter Type fn function Returns an iterator that returns all objects that satisfy a predicate.
Returns: function
Parameter Type fn function Iterates through all objects and calls a function
fn
that takes the objects as an argument.Returns: nil
Parameter Type k * 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.Returns: *
Parameter Type ... string/function This returns an iterator that, when called, returns the values from each encountered object, picked by the provided keys. If a key is a string, the objects are indexed with the string. If a key is a function, the function is called with the object passed as its first argument.
Returns: function
Returns a random object that is contained in the iterable.
Returns: *
Parameter Type ... string 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 keys provided.
Returns: table
Parameter Type Optional sortBy string ✔ fn function ✔ 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.Returns: table
Returns an iterator that returns all contained objects. The order of the objects is not guaranteed.
Returns: function