<Var/Array> = The name of the source array.
<Var/Number> = The first element to be copied in the source array.
<Var/Number> = The last element to be copied in the source array.
<Var/Array> = The name of the destination array.
<Var/Number> = The index in the destination array for the first copied element from the source array.
Copies the contents of the source <Var/Array> from elements <Var/Number> to <Var/Number> into the already existing destination array <Var/Array>.
The destination array must have been previously allocated large enough to hold all the elements.
$station.array = $sector get station array from sector
$station.array.size = size of array $station.array ... (for arguments sake, lets say $station.array.size = 10)
$needed.array.size = $station.array.size / 2 ... (5 = 10 / 2)
$partial.array = array alloc: size= $needed.array.size
$mid.point = $needed.array.size - 1 ... (4 = 5 - 1)(remember the first element in an array = 0 not 1, so 0, 1, 2, 3, 4 = 5 elements)
copy array $station.array index 0 ... $mid.point into array $partial.array at index 0
In the above example, $partial.array would be the first half of $station.array.
(checks for size of $station.array being greater than 1 and other needed checks have been omitted from the example for the sake of less complexity)
- »» General Commands
- »» Arrays
copy array <Var/Array> index <Var/Number> ... <Var/Number> into array <Var/Array> at index <Var/Number>
- »» Arrays