TestArray is a Array. CopyArray is a dynamic array.
To add items to a dynamic array, you use Add or AddItem (or the method you were trying to do).
http://udn.epicgames.com/Three/Unrea...es.html#Arrays
http://udn.epicgames.com/Three/Unrea....html#DynArray
I don't get the intention behind your code. You are changing the CopyArray dynamically and using the length to access a static array. It would result into a "out of bound" error.
Code:
TestArray [0]= 9;
TestArray [1]= 5;
TestArray [2]= 6;
CopyArray[CopyArray.length] = TestArray[CopyArray.length - 1]; // CopyArray[0] = TestArray[0 - 1] // out of bound
CopyArray[CopyArray.length] = TestArray[CopyArray.length - 1]; // CopyArray[1] = TestArray[1 - 1]
CopyArray[CopyArray.length] = TestArray[CopyArray.length - 1]; // CopyArray[1] = TestArray[2 - 1]
`log("Copy array length:" @CopyArray.length);
If you want to copy an array (not a dynamic array) use a for loop and the ArrayCount function.
Code:
local int i;
//CopyArray.Empty
CopyArray.Length = 0;
for (i = 0; i<ArrayCount(TestArray); i++) {
CopyArray.Length[i] = TestArray[i];
}
Bookmarks