This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
array [2020/02/16 21:09] – justin | array [2024/02/17 10:19] – justin | ||
---|---|---|---|
Line 44: | Line 44: | ||
</ | </ | ||
List of integers from 5 to, but not including, 0, with an increment of -1 (i.e. 5, 4, 3, 2, 1). | List of integers from 5 to, but not including, 0, with an increment of -1 (i.e. 5, 4, 3, 2, 1). | ||
+ | |||
+ | =====Functions===== | ||
+ | The following functions can be used to manipulate or retrieve the values in an array. | ||
+ | ^Name^Description^ | ||
+ | |push_front(value)|Appends a value to the beginning of an array.| | ||
+ | |push_back(value)|Appends a value to the end of an array.| | ||
+ | |pop_front()|Removes and returns the first value of an array.| | ||
+ | |pop_back()|Removes and returns the last value of an array.| | ||
+ | |insert(index, | ||
+ | |remove(index)|Removes a value from an array at the specified index (starting at 0).| | ||
+ | |erase(value)|Removes the first occurrence of the specified value from an array.| | ||
+ | |clear()|Removes all values from an array.| | ||
+ | |size()|Returns the number of items in an array.| | ||
+ | |||
+ | ====Examples: | ||
+ | <code bauxite> | ||
+ | $my_array.push_front($my_value); | ||
+ | </ | ||
+ | <code bauxite> | ||
+ | $my_array.push_back($my_value); | ||
+ | </ | ||
+ | <code bauxite> | ||
+ | $first_value = $my_array.pop_front(); | ||
+ | </ | ||
+ | <code bauxite> | ||
+ | $last_value = $my_array.pop_back(); | ||
+ | </ | ||
+ | <code bauxite> | ||
+ | $my_array.insert(1, | ||
+ | </ | ||
+ | <code bauxite> | ||
+ | $my_array.remove(2); | ||
+ | </ | ||
+ | <code bauxite> | ||
+ | $my_array.erase(entity[" | ||
+ | </ | ||
+ | <code bauxite> | ||
+ | $my_array.clear(); | ||
+ | </ | ||
+ | <code bauxite> | ||
+ | $item_count = $my_array.size(); | ||
+ | </ | ||
~~NOTOC~~ | ~~NOTOC~~ |