RobotStudio event

How to fill RobTarget array

Options
With the WriteItem function you can fill in the array by using the index. But when I use this function I get the error: Index is out of range. My Question know is, how to create a RobTarget[]  and fill it and put it in the controller.