The error is that
and
will not copy the content of data_item into xxx and yyy separately.
xxx and yyy will become 2 References to data_item.
So both xxx and yyy will not have a real content but will point to the content of data_item
I would use List instead of Arrays
Dim data_item as List
Dim xxx as List
Dim yyy as List
data_item.Initialize
xxx.Initialize
yyy.Initialize
For np = 1 To Main.num_players
data_item.Add(players_scores(np).name)
For nn = 1 To 9
data_item.Add(players_scores(np).score(nn))
Next
data_item.Add(players_scores(np).front)
For nn = 10 To 18
data_item.Add(players_scores(np).score(nn))
Next
data_item.Add(players_scores(np).back)
If np=1 Then
xxx.AddAll(data_item) 'This will copy the content of data_item into xxx
End If
If np=2 Then
yyy.AddAll(data_item) 'This will copy the content of data_item into yyy
End If
data_item.Clear
Next
Dim Data as List
Data.Initialize
Data.AddAll(xxx) 'This will copy the content of xxx into Data
Data.AddAll(yyy) 'This will copy the content of yyy into Data, adding it to the xxx one
I STRONGLY suggest you to name every variable with a concrete and senseful name.
It will help you during coding.
I hope that xxx, yyy and zzz was just for the example to be fast.
I kept the different lists as you have done.
Maybe you need xxx and yyy to have the info of every single players separated.
If not I would do it directly with one list
Dim data as List
data.Initialize
For np = 1 To Main.num_players
data.Add(players_scores(np).name)
For nn = 1 To 9
data.Add(players_scores(np).score(nn))
Next
data.Add(players_scores(np).front)
For nn = 10 To 18
data.Add(players_scores(np).score(nn))
Next
data.Add(players_scores(np).back)
Next