Skip to content

HashMap

Hyomoto edited this page Jun 13, 2021 · 3 revisions
Jump To Go Back Methods Variables

HashMap( )

Implements: Struct

Creates a hash table-type structure. Can be used a garbage-collected replacement for ds_map.

Methods

Jump To top set unset lookup lookup_by_array key_exists keys_to_array from_JSON to_JSON clear is_empty size

set( key, value )

Returns: self

Throws: InvalidArgumentType

Name Type Purpose
key string The key used to look up the value
value mixed The value to assign to the key

Sets the given key in the dictionary to the provided value. If the key is not a string, InvalidArgumentType will be thrown.


unset( key )

Returns: self

Throws: InvalidArgumentType, ValueNotFound

Name Type Purpose
key string The key to remove

Removes the given key from the dictionary. If the key didn't exist, ValueNotFound will be thrown. If the key was not a string, InvalidArgumentType is thrown.


lookup( key )

Returns: mixed

Throws: InvalidArgumentType, ValueNotFound

Name Type Purpose
key string The key to look up

Looks up the given key in the dictionary and returns its value. If the key is not a string, InvalidArgumentType is thrown. If the value does not exist, ValueNotFound will be thrown.


lookup_by_array( order )

Returns: array

Throws: InvalidArgumentType, ValueNotFound

Name Type Purpose
order array The array of keys to return

Looks up each key in the provided order and returns the resulting array. If the key is not a string InvalidArgumentType will be thrown, and if the value does not exist, ValueNotFound will be thrown.


key_exists( key )

Returns: bool

Throws: InvalidArgumentType

Name Type Purpose
key string No description

Returns true if the specified key exists in the dictionary. If the key is not a string InvalidArgumentType will be thrown.


keys_to_array( )

Returns: array

Name Type Purpose
None

Returns the keys in the dictionary formatted as an array.


from_JSON( JSON_string )

Returns: self

Throws: InvalidArgumentType, UnexpectedTypeMismatch

Name Type Purpose
JSON_string string The string to convert into a dictionary

Takes the provided string and uses it to populate the dictionary. If a string is not provided, InvalidArgumentType is thrown. If the string does not convert into a dictionary UnexpectedTypeMismatch will be thrown.


to_JSON( )

Returns: string

Name Type Purpose
None

Returns this dictionary as a JSON string.


clear( )

Name Type Purpose
None

Empties the hash table


is_empty( )

Returns: int

Name Type Purpose
None

Returns true if this dictionary contains no keys.


size( )

Returns: mixed

Name Type Purpose
None

Returns the number of entries in the dictionary.


Variables

Jump To top
Name Type Initial Purpose
__Content struct {} The internal struct which holds the key/value pairs.
Clone this wiki locally