How to store variables of different types in one way.
OK, I have lots of individual variables in my software
but now looking to handle these variables in a better way. I first looked at an Array but you can not store different type in the array.aa=1
ab=2
ac="Tree"
ad=4
ae="Roots"
af=12212.2
etc etc
So then I looked at Map which I thought would do the job nicely but found out that you can not mix variable types.
So I looked at a list, but again not able to mix variable types.
So I then looked at Structure with Map. There are some examples in the help file and looks promising but type to add different variables works, ie I can store mixed variable type but not access them. Am I doing something wrong
Code: Select all
Structure Car
Weight.l
Speed.l
Price.l
Model.s
EndStructure
NewMap Cars.Car()
Cars("Ferrari F40")\Weight = 1000
Cars()\Speed = 320
Cars()\Price = 500000
Cars()\Model = "GT"
Cars("Lamborghini Gallardo")\Weight = 1200
Cars()\Speed = 340
Cars()\Price = 700000
Cars()\Model = "XY"
ForEach Cars()
Debug "Car name: "+MapKey(Cars())
Debug "Model: "+Str(Cars()\Model.s)
Debug "Weight: "+Str(Cars()\Weight)
Debug "Speed: "+Str(Cars()\Speed)
Next