DIM TYPE - redimming is it possible

mattsaintdev

Member
Licensed User
Hi,

i have a 2d array in the Globals section e.g.

Dim Type(dbref,firstname,surname) Personnel(0)

In a function i would like to 'REDIM' the size of the array but when i do ;

Sub MyFunc
Dim Personnel(100)
End Sub

The array looses its TYPE and becomes an array of 100 elements - or so the compiler says.

Thanks in advance!

Matt
 

klaus

Expert
Licensed User
Instead of

B4X:
Sub MyFunc
Dim Personnel(100)
End Sub
you should use

B4X:
Sub MyFunc
Dim Personnel(100,3)
End Sub
B4PPC treats the Type Variable as 2 dimensional arrays.

In your case with
Dim Type(dbref,firstname,surname) Personnel(0)
and
Dim Personnel(100,3)

Personnel(10).dbref is the same as Personnel(10,0)
Personnel(10).firstname is the same as Personnel(10,1)
Personnel(10).surname is the same as Personnel(10,2)

Best regards.
 
Top