Structure Test
String.s
List x.s()
EndStructure
Structure TestEx Extends Test
State.a
Array y.l(10)
EndStructure
x.Test
y.TestEx
x\String="1234"
For i=0 To 10
AddElement(x\x())
x\x() = Str(i)
Next i
CopyStructure(@x, @y, Test)
Debug y\String
ForEach y\x()
Debug y\x()
Next
Debug y\State
Size = ArraySize(y\y())
Debug Size
For i=0 To Size
Debug y\y(i)
Next
Code seems to work without errors. But can there be any problems because of this copy?
Apologize if these have been asked before?
What is the difference between:
CopyStructure(Struct1, Struct2, someStruct)
and
Struct2.someStruct = Struct1.someStruct?
ClearStructure(@Struct1, someStruct) vs ResetStructure(@Struct1, someStruct)?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
i think CopyStructure() makes sense only if Struct2 was a pointer (*Struct2) where assignment wouldn't copy.
ClearStructure() will invalidate/delete any List or Map object ect. contained in the structure and would need an additional InitializeStructure() to make those usable again.
ResetStructure() will empty those but keep them alive.