This documents how to use the various functions provided by this project. Any function not documented here is supposed to be a function internal to the library, and it isn't recommended that you use it.
Note that array names (just like variable names) cannot have spaces in them.
Document format:
## Feature
#### `function`
Description
Initialize an array of name ARRAY
. Sets its size and iterator to -1.
Assign the VALUE at the specified INDEX in ARRAY.
Append every given VALUE to ARRAY.
Retrieve the value from ARRAY at INDEX.
Set the iterator to -1.
Move ARRAY's iterator to the next value. If there is no next value, return error code 1.
Move ARRAY's iterator to the previous value. If there is no previous value, return error code 1.
Returns the value at the position of the iterator in ARRAY.
Set the value at the iterator in ARRAY to VALUE.
Prints the size of ARRAY. -1 means an empty array.
Prints ARRAY's iterator value.
Prints the variables that make up ARRAY, each variable is quoted, like so:
"$my_awesome_array_0" "$my_awesome_array_1" "$my_awesome_array_2"
Use this in combination with an eval
to pass the array as arguments:
eval "printf '%s\n' $(array_print_esc my_awesome_array)"