API/Enumerable-Action
Enumerable.prototype:Do(action)
Return an enumerable that when looped over, runs an action but returns the current value regardless.
Parameters
- action
- a function to call that has the element and the 1-based index passed in.
Return value
an Enumerable
Usage
Enumerable.From({ 1, 2, 3 }):Do(function(x) print(x) end)
Enumerable.prototype:ForEach(action)
Immediately performs an action on each element in the sequence.
If the action returns false, that will act as a break and prevent any more execution on the sequence.
Parameters
- action
- a function that takes the element and the 1-based index of the element.
Usage
Enumerable.From({ 1, 2, 3, 4 }):ForEach(print)
Enumerable.prototype:Force()
Iterate over an enumerable, forcing it to execute
Comments