CopyArray()

语法

Result = CopyArray(SourceArray(), DestinationArray())
概要
Copy every elements of 'SourceArray()' into 'DestinationArray()'. After a successful copy, the two arrays are identical. The arrays must have the same number of dimensions.

参数

SourceArray() The array to copy from.
DestinationArray() The array to copy to. Every element previously found in this array will be deleted. This array must be of the same type (native or structured) and the same number of dimensions of the source array.

返回值

Returns nonzero if the copy succeeded or zero if it failed.

示例

  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)

参阅

CopyList(), CopyMap()

已支持操作系统

所有

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