Page 1 of 1

Assign to array in structure?

Posted: Wed Jul 19, 2017 5:56 am
by Smetad_Anarkist
I'm want to create a structure where one of the fields is an array so I did this

Code: Select all

Structure MyState
   Array statedata.l()
EndStructure
Then I want to assign an array to that field, and everything fell down. I can't figure out how to do that. It appears that I can create a loop to assign individual elements to an array in a structure, but not the entire array. I get syntax error when I try.

Code: Select all

state\statedata() = temp()

Re: Assign to array in structure?

Posted: Wed Jul 19, 2017 6:20 am
by wilbert
You can copy the array content with CopyArray.

Code: Select all

Structure MyState
   Array statedata.l(5)
EndStructure

Define state.MyState

Dim MyArray.l(5)
MyArray(4) = 5

CopyArray(MyArray(), state\statedata())

Debug state\statedata(4)