Repository navigation
Array
An array is an integer-indexed, dynamically resizable container. Items can be accessed by their index in linear time. Every index in the array is considered valid, with empty indices returning nil. The 'count' property is simply the greatest index of any element in the array, plus one.
Creates a new buffer with capacity for 'capacity' elements. Regardless of the initial capacity, the number of elements in the array will always be zero after construction.
@destroy()
Releases memory used by the array.
Returns the element at 'index'. If 'index' is greater than 'count', this function return nil.
Sets the element at 'index' to 'element'. If 'index' is greater than 'count', then the array will be resized to accomodate 'index'.
Concatenates this array with 'other', and returns the result
Sets the number of elements in the array. If 'count' is greater than the size of the array, then the size of the array is increased, with new array buckets being set to nil. If 'count' is less than the size of the array, then the size of the array is reduced, and elements belonging to removed buckets are freed.
Reserves at least storage for at least 'capacity' elements. If 'capacity' is smaller than the current capacity, the array will shrink to the number of elements in the array. Setting capacity to a value less than 'count' will result in 'capacity' being set equal to 'count'.
Adds 'element' to the beginning of the array, and shifts all other elements up by one index.
Removes the first element from the array, and shifts all other elements down by one index.
Adds 'element' to the end of the array.
Adds 'element' to the end of the array (synonym for 'push')
Removes the element at the end of the array, and reduces the count.
Returns the element at index 0
Returns the last element in the array.
Returns a new array containing all of the elements from the beginning of the array to the element before 'end'
Returns a new array containing elements starting at 'begin' and continuing to the end of this string.
Returns a new array containing the elements starting at 'begin' and ending at the element before 'end'.
compact!()
Removes any nil elements in the array, and shifts the remaining elements down into a contiguous block.
Returns true if the array is empty
clear()
Clears all the items from this array.
Returns an iterator over the elements in this array
No comment
No comment