Class Range.Array
A array of Ranges.
Used for efficient handling of such arrays.
Functions
Array.new (array) | Create a new array. |
Array.pack (...) | Create a new array from a variable number of arguments. |
Array.from_table (array) | Alias for new. |
Methods
Array:unpack ([i=1[, j=length of array]]) | Unpack the array. |
Array:to_table () | Convert the array to a Lua table. |
Array:copy () | Create a copy of the array. |
Array:at (index) | Get the Range at a given index. |
Array:set_at (index, value) | Set the Range at a given index. |
Metamethods
Array:__len () | Get the length of the array. |
Array:__eq (other) | Check equality of two arrays. |
Functions
- Array.new (array)
-
Create a new array.
If you do not already have a Lua table of the Ranges, consider using pack.
Parameters:
- array {Range}
Returns:
- Array.pack (...)
-
Create a new array from a variable number of arguments.
Parameters:
- ... Range
Returns:
- Array.from_table (array)
-
Alias for new.
Parameters:
- array {Range}
Returns:
Methods
- Array:unpack ([i=1[, j=length of array]])
-
Unpack the array.
Inverse of pack if
i
andj
are omitted.Parameters:
- i integer (default 1)
- j integer last index to unpack (inclusive) (default length of array)
Returns:
-
Range...
- Array:to_table ()
-
Convert the array to a Lua table.
Inverse of from_table.
Returns:
- Array:copy ()
-
Create a copy of the array.
Returns:
- Array:at (index)
-
Get the Range at a given index.
Parameters:
- index integer
Returns:
Raises:
Indexing a non-positive index.
Indexing beyond last element. - Array:set_at (index, value)
-
Set the Range at a given index.
Parameters:
- index integer
- value Range
Raises:
Indexing a non-positive index.
Indexing beyond last element.
Mutating an unmanaged array.
Metamethods
- Array:__len ()
-
Get the length of the array.
Returns:
-
integer
- Array:__eq (other)
-
Check equality of two arrays.
Parameters:
- other Array
Returns:
-
boolean