Skip to content
mystborn edited this page Jun 22, 2018 · 1 revision

ds_map

A ds_map is a simple dictionary (also known as map, hashmap, associative array, etc) object.

Fields

count

Description: Gets the number of items added to the map.

Returns: number

keys

Description: Gets an array of the keys added to the map.

Returns: array

Constructor

new()

Description: Initializes an empty map.

Returns: ds_map

Scripts

add(key, value)

Argument Expected Type Description
key object The key of the element to add.
value object The value of the element to add.

Description: Attempts to add the key and value to the map. If the key has already been added, returns false.

Returns: bool

clear()

Description: Clears all elements from the map.

Returns: null

contains_key(key)

Argument Expected Type Description
key object The key to search for.

Description: Determines if the key has previously been added to the map.

Returns: bool

copy()

Description: Creates a shallow copy of the map.

Returns: ds_map

get(key)

Argument Expected Type Description
key object The key of the element to get.

Description: Attempts to get the value with the specified key. Returns null if the key wasn't found.

Returns: object

remove(key)

Argument Expected Type Description
key object The key of the element to remove.

Description: Attempts to remove the element with the specified key. If the key couldn't be found, returns false.

Returns: bool

set(key, value)

Argument Expected Type Description
key object The key of the element to set.
value object The value of the element to set.

Description: Sets the element with the specifed key within the map. Can overwrite previously added keys.

Returns: null

Clone this wiki locally