I thought I could copy a structure with a() = b() but it seems only the pointer to a() is set to b()
A sample with two modules to illustrate:
Module A
B4X:
Sub Globals
Public Type (A, B, C) aType(0)
End Sub
Sub App_Start
form1.Show
aType() = Array(("A", "B", "C"))
initThis
End Sub
Public Sub initThis
Button1.Text = aType(0).A
End Sub
Sub Button1_Click
aForm.initThis
End Sub
Module B
Sub Globals
Dim Type (A, B, C) aType(0)
End Sub
Public Sub initThis
aForm1.Show
aType() = main.aType()
aType(0).A = "C"
aButton1.Text = aType(0).A
aForm1.Show
End Sub
Sub aButton1_Click
aForm1.Close
main.initThis
End Sub
If you want to create a new copy then you should use ArrayCopy.
However it only supports single dimension arrays or regular structs:
B4X:
Sub Globals
Public Type (A, B, C) aType1
Public Type (A, B, C) aType2
End Sub
Sub App_Start
aType1() = Array("A", "B", "C")
ArrayCopy(aType1(),0,3,aType2(),0)
aType2.A = "AA"
Msgbox(aType1.A,aType2.A)
End Sub