;
; ------------------------------------------------------------
;
; SpiderBasic - Map example file
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;
Structure BasicStructure
Field1.b
Field2.w
Field3.l
EndStructure
NewMap TestMap.BasicStructure()
;
;-------- Add Elements and TestMaps --------
;
TestMap("ok1")\Field2 = 1
TestMap("ok2")\Field2 = 2
TestMap("ok3")\Field2 = 3
TestMap("ok4")\Field2 = 4
Debug "Number of elements in the Map: " + MapSize(TestMap())
; First way to Map all the elements
;
ResetMap(TestMap()) ; Reset the Map index before the first element.
While NextMapElement(TestMap()) ; Process all the elements...
Debug "Field2 value : " + TestMap()\Field2
Wend
Debug "Now uses 'ForEach' type listing:"
; Second way, with the help of ForEach
;
ForEach TestMap() ; Process all the elements...
Debug "Field2 value : " + TestMap()\Field2
Next
Debug "Uses direct access to the 3rd element:"
; Go directly to the 3rd element
FindMapElement(TestMap(), "ok3")
Debug "Field2 value : " + TestMap()\Field2