Typed wrapper around Godot’s Array class, an array of Variant
typed elements allocated in the engine in C++. Useful when
interfacing with the engine. Otherwise prefer .NET collections
such as arrays or .
Constructors
Array__ItemData.__new()
Constructs a new empty .
Array__ItemData.__new(IEnumerable__ItemData)
Array__ItemData.__new(collection: IEnumerable__ItemData)
Type |
Name |
Description |
IEnumerable__ItemData |
collection |
|
Array__ItemData.__new(ItemData[])
Array__ItemData.__new(array: ItemData[])
Type |
Name |
Description |
ItemData[] |
array |
|
Array__ItemData.__new(Array)
Constructs a typed from an untyped .
Array__ItemData.__new(array: Array)
Type |
Name |
Description |
Array |
array |
The untyped array to construct from. |
ReadOnly
Type |
Name |
Static |
Default |
Description |
number |
Count |
|
|
Returns the number of elements in this . This is also known as the size or length of the array. |
boolean |
IsReadOnly |
|
|
Returns if the array is read-only. See . |
Properties
Type |
Getter |
Setter |
Static |
Default |
Description |
ItemData |
get_Item() |
set_Item(val) |
|
|
|
Functions
Requires an instance!
Duplicate(boolean)
Duplicates this .
Duplicate(deep: boolean = False) -> Array__ItemData
Type |
Name |
Description |
boolean |
deep |
If , performs a deep copy. |
Fill(ItemData)
Fill(value: ItemData) -> nil
Type |
Name |
Description |
ItemData |
value |
|
Max
Returns the maximum value contained in the array if all elements are of comparable types. If the elements can’t be compared, is returned.
Min
Returns the minimum value contained in the array if all elements are of comparable types. If the elements can’t be compared, is returned.
PickRandom
Returns a random value from the target array.
RecursiveEqual(Array__ItemData)
Compares this against the recursively. Returns if the sizes and contents of the arrays are equal, otherwise.
RecursiveEqual(other: Array__ItemData) -> boolean
Type |
Name |
Description |
Array__ItemData |
other |
The other array to compare against. |
Resize(number)
Resizes this to the given size.
Resize(newSize: number) -> Error
Type |
Name |
Description |
number |
newSize |
The new size of the array. |
Reverse
Reverses the order of the elements in the array.
Shuffle
Shuffles the array such that the items will have a random order. This method uses the global random number generator common to methods such as . Call to ensure that a new seed will be used each time if you want non-reproducible shuffling.
Slice(number)
Creates a shallow copy of a range of elements in the source .
Slice(start: number) -> Array__ItemData
Type |
Name |
Description |
number |
start |
The zero-based index at which the range starts. |
Slice(number,number)
Creates a shallow copy of a range of elements in the source .
Slice(start: number,length: number) -> Array__ItemData
Type |
Name |
Description |
number |
start |
The zero-based index at which the range starts. |
number |
length |
The length of the range. |
GetSliceRange(number,number,number,boolean)
Returns the slice of the , from (inclusive) to (exclusive), as a new . The absolute value of and will be clamped to the array size. If either or are negative, they will be relative to the end of the array (i.e. arr.GetSliceRange(0, -2) is a shorthand for arr.GetSliceRange(0, arr.Count - 2)). If specified, is the relative index between source elements. It can be negative, then must be higher than . For example, [0, 1, 2, 3, 4, 5].GetSliceRange(5, 1, -2) returns [5, 3]. If is true, each element will be copied by value rather than by reference.
GetSliceRange(start: number,end: number,step: number = 1,deep: boolean = False) -> Array__ItemData
Type |
Name |
Description |
number |
start |
The zero-based index at which the range starts. |
number |
end |
The zero-based index at which the range ends. |
number |
step |
The relative index between source elements to take. |
boolean |
deep |
If , performs a deep copy. |
Sort
Sorts the array. Note: The sorting algorithm used is not stable. This means that values considered equal may have their order changed when using . Note: Strings are sorted in alphabetical order (as opposed to natural order). This may lead to unexpected behavior when sorting an array of strings ending with a sequence of numbers. To sort with a custom predicate use .
IndexOf(ItemData)
IndexOf(item: ItemData) -> number
Type |
Name |
Description |
ItemData |
item |
|
IndexOf(ItemData,number)
IndexOf(item: ItemData,index: number) -> number
Type |
Name |
Description |
ItemData |
item |
|
number |
index |
|
LastIndexOf(Variant)
Searches the array for a value in reverse order and returns its index or -1 if not found.
LastIndexOf(item: Variant) -> number
Type |
Name |
Description |
Variant |
item |
The item to search for. |
LastIndexOf(Variant,number)
Searches the array for a value in reverse order and returns its index or -1 if not found.
LastIndexOf(item: Variant,index: number) -> number
Type |
Name |
Description |
Variant |
item |
The item to search for. |
number |
index |
The initial search index to start from. |
Insert(number,ItemData)
Insert(index: number,item: ItemData) -> nil
Type |
Name |
Description |
number |
index |
|
ItemData |
item |
|
RemoveAt(number)
Removes an element from the array by index. To remove an element by searching for its value, use instead.
RemoveAt(index: number) -> nil
Type |
Name |
Description |
number |
index |
The index of the element to remove. |
MakeReadOnly
Makes the read-only, i.e. disabled modying of the array’s elements. Does not apply to nested content, e.g. content of nested arrays.
Add(ItemData)
Add(item: ItemData) -> nil
Type |
Name |
Description |
ItemData |
item |
|
AddRange(IEnumerable__ItemData)
Adds the elements of the specified collection to the end of this .
AddRange(collection: IEnumerable__ItemData) -> nil
Type |
Name |
Description |
IEnumerable__ItemData |
collection |
Collection of items to add. |
BinarySearch(number,number,ItemData)
BinarySearch(index: number,count: number,item: ItemData) -> number
Type |
Name |
Description |
number |
index |
|
number |
count |
|
ItemData |
item |
|
BinarySearch(ItemData)
BinarySearch(item: ItemData) -> number
Type |
Name |
Description |
ItemData |
item |
|
Clear
Clears the array. This is the equivalent to using with a size of 0
Contains(ItemData)
Contains(item: ItemData) -> boolean
Type |
Name |
Description |
ItemData |
item |
|
CopyTo(ItemData[],number)
CopyTo(array: ItemData[],arrayIndex: number) -> nil
Type |
Name |
Description |
ItemData[] |
array |
|
number |
arrayIndex |
|
Remove(ItemData)
Remove(item: ItemData) -> boolean
Type |
Name |
Description |
ItemData |
item |
|
GetEnumerator
Gets an enumerator for this .
GetEnumerator() -> IEnumerator__ItemData
ToString
Converts this to a string.