ds_map_set


描述

With this function you can set the value of a key within a given DS map. You supply the DS map ID value (as returned by the function ds_map_create(), then give the key you want to set and the value to set it to. Keys can be integers or strings, and if the given key does not exist then it will be created for you. This function is the same as using the DS map accessor to set/create a map key/value pair.


语法:

ds_map_set(id, key, value)

参数 描述
id The id of the map to use.
key The key to set.
The value to set the key to.


返回:

N/A(无返回值)


例如:

if is_undefined(ds_map_find_value(map, "score"))
    {
    ds_map_set(map, "score", 0);
    }

The above code will check to see if the given key exists and if it doesn't then it is created and set.