Skip to content
Hyomoto edited this page Dec 12, 2020 · 14 revisions
Jump To Go Back Arguments Methods Variables

DsMap()

Implements: None

Creates a wrapper for GML's map data structure. If using GMS2.3.1 or above, the structure will be cleaned up automatically, otherwise destroy() must be called to properly clean it up.

// no example

Arguments

Name Type Purpose
None

Methods

Jump To top add replace assume empty size find first next remove
destroy read copy toArray toString is

add( key, value )

Returns: mixed

Name Type Purpose
key string The key that will be used to retrieve this value.
value mixed The value to be assigned to the key.

Adds the specified key-value pair to the map.


replace( key, value )

Returns: mixed

Name Type Purpose
key string The key to retrieve from the map.
value mixed The value to be assigned to the key.

Adds the specified key-value pair if it doesn't exist, and replaces it if it does.


assume( key, value )

Returns: mixed

Name Type Purpose
key string The key to retrieve from the map.
value mixed The value that will be set if key does not exist.

If the value read at {key} is undefined, the value at {key} assumes the value of {value}


empty()

Returns: N/A undefined

Name Type Purpose
None

Returns true if the DsMap is empty


size()

Returns: N/A undefined

Name Type Purpose
None

Returns the number of elements in the DsMap


find( key, undefined )

Returns: N/A undefined

Name Type Purpose
key string The key to find in the map.
undefined mixed optional: The value to return if the key is undefined.

Searches for the given key, and returns the value if found, other wise undefined.


first()

Returns: N/A undefined

Name Type Purpose
None

Returns the first key in the map.


next( _key )

Returns: N/A undefined

Name Type Purpose
_key undef none provided

Returns the next key in the map after the given key.


remove( key )

Returns: N/A undefined

Name Type Purpose
key string The key to find in the map.

If the given key exists, it will be removed from the map.


destroy()

Returns: N/A undefined

Name Type Purpose
None

Destroys the internal map, required to properly clean up DsMap


read( _string )

Returns: N/A undefined

Name Type Purpose
_string undef none provided

Decodes the given string into the contents of the map.


copy()

Returns: N/A undefined

Name Type Purpose
None

Returns a copy of the internal map.


toArray()

Returns: array ([values...])

Name Type Purpose
None

Returns the map as an array of values.


toString()

Returns: string ("string")

Name Type Purpose
None

Encodes the map as a string.


is( type )

Returns: boolean (true or false)

Name Type Purpose
type Constructor The Constructor to compare this against.

Returns true if the provided type is DsMap.


Variables

Jump To top
  • pointer - The internal pointer to the map data structure.
Clone this wiki locally