MapKeyCount
- Last UpdatedJul 18, 2023
- 1 minute read
Use this function to retrieve the number of keys in a map.
Syntax
INT MapKeyCount(STRING sMapName)
sMapName:
Name of the map.
Return Value
The number of keys in the map, or a value less than 0 if an error is encountered.
If the map name is empty an "Invalid argument" error (274) will be raised.
Example
! Demonstrate MapKeyCount.
STRING sMapName = MapOpen();
! sMapName is a randomly generated text that uniquely identifies the map
INT iMapKeyCountResultExpectZero = MapKeyCount(sMapName);
! iMapKeyCountResultExpectZero will be set to 0
INT iMapValueSetResult = MapValueSet(sMapName, "SomeKey", "SomeValue");
INT iMapKeyCountResultExpectOne = MapKeyCount(sMapName);
! iMapKeyCountResultExpectOne will be set to 1
INT iMapCloseResult = MapClose(sMapName);
! The map that is identified by sMapName is now closed and unavailable
Related Functions
MapClear, MapClose, MapOpen, MapKeyDelete, MapKeyExists, MapKeyFirst, MapValueGet, MapKeyNext, MapValueSet, MapValueSet