The ds_map data structure is an exceptionally useful one as it lets you store key and value pairs. For example, a character in your game can have a quantity of different items (keys) and for each individual item he can have a number of them (values), like in an RPG where you can have 10 health potions, 5 mana potions and 100 gold. Maps maintain such pairs all together in the one place and you can add pairs to the map and search for the value corresponding to certain keys as well using some simple functions. There are a couple of things you should know about maps before you use them, however! Maps are not sorted in any (recognisable) way, meaning that to find a certain key you may have to iterate through the whole thing (which is very slow). There is also no way to hold two keys that are the same, nor can you assign one key two values.
The following functions exist that deal with DS maps.
There are four further functions available for saving and loading a ds_map. These functions will obfuscate the map and store it in a secure location on the target platform using a file format that means that the final file is not able to be transfered between devices:
Apart from these specific functions you can all use an expression (called an accessor) to add or modify the contents of your ds_map. This accessor looks similar to a 1D array with the following syntax:
You can find more information, plus examples, from from the GML Overview page on Accessors.
One of the uses that ds_maps have is when working with JSON, and so there are a few special functions that are specific to that:
There are also a couple of complimentary functions for ds_lists: