CopyArray()

Syntax

Result = CopyArray(SourceArray(), DestinationArray())
Description
Copy every elements of 'SourceArray()' into 'DestinationArray()'. If the two arrays are not of the same type (native or structured) the copy will fail and 'Result' will be 0. Every elements previously found in 'DestinationArray()' will be deleted. After a successful copy, the two arrays are identicals.

Example:

  Dim Numbers(5)
  Dim NumbersCopy(10)
  
  Numbers(0) = 128
  Numbers(5) = 256
  
  Debug "Array size before copy: "+Str(ArraySize(NumbersCopy())) ; will print 10
  
  CopyArray(Numbers(), NumbersCopy())
  
  Debug "Array size after copy: "+Str(ArraySize(NumbersCopy())) ; will print 5
  Debug NumbersCopy(0)
  Debug NumbersCopy(5)

Supported OS

All

<- ArraySize() - Array Index - FreeArray() ->