The range
module
The range
module provides a range type and functions for working with ranges. Ranges are used to represent a sequence of numbers that can be iterated over. Ranges have collection
as their metatable.
Free functions
exclusive(start: number, end: number): range
Returns a range from start
to end
(exclusive).
inclusive(start: number, end: number): range
Returns a range from start
to end
(inclusive).
Member fields
start: number
The start of the range.
end: number
The end of the range (exclusive).
step: number
The step of the range.
Member functions
size(self): number
Returns the length of the range.
Metamethods
__index__(self, key: number): number
Returns the value at the given index in the range.
__iter__(self): table
Returns an iterator for the range.