Warning: This feature is experimental. It may not work, may contain bugs or may be changed or removed without notice.

DO NOT REPORT BUGS OR REQUEST NEW FEATURES FOR THIS FEATURE.

Function Reference


MapKeys

Show description in

Returns an array holding the keys within a Map.

MapKeys ( map )

Parameters

map An existing Map

Return Value

Success: a 1 dimension array containing the keys.
Failure: a zero based array and sets the @error flag to non-zero

Remarks

The returned array can be used to iterate the values held within the Map

Example

#include <MsgBoxConstants.au3>

Example()

Func Example()
        ; Declare a map and assign with various keys value pairs.
        Local $mMap[]
        $mMap[1] = "Integer One" ; Integer value as a key.
        $mMap["2"] = "String Two" ; String value representing an integer as a key. This is a string not an integer.
        MapAppend($mMap, "Integer Two") ; Append a value using the next available integer, which is 2 in this case.

        ; Retrieve the keys contained in the map. A zero-based one-dimensional array is returned.
        Local $aMapKeys = MapKeys($mMap)
        For $vKey In $aMapKeys ; Or a For loop can be used as well.
                MsgBox($MB_SYSTEMMODAL, "", "Key: " & $vKey & @CRLF & _ ; The key.
                                "Value: " & $mMap[$vKey] & @CRLF & _ ; Use the array value of MapKeys() to display the value of the key.
                                "Variable Type: " & VarGetType($vKey) & @CRLF) ; Display the variable type of the key i.e. integer or string.
        Next
EndFunc   ;==>Example