Hashtable

Hashtable

A generic map (key-value) container.

Used notably for storing lists of objects for GDevelop generated events.

Constructor

new Hashtable()

Source:

Members

items

The content of the Hashtable. Prefer using methods rather than accessing this internal object, unless you need to iterate on the values.

Source:

items

The content of the Hashtable. Prefer using methods rather than accessing this internal object, unless you need to iterate on the values.

Source:

Methods

(static) newFrom(items)

Construct a Hashtable from a JS object.

Parameters:
Name Type Description
items

The content of the Hashtable.

Returns:
Type Description

The new hashtable.

Source:

clear()

Clear the Hashtable.

Source:

containsKey(key)

Verify if a key exists in the Hashtable.

Parameters:
Name Type Description
key

The key to search in the Hashtable.

Returns:
Type Description

true if the key exists.

Source:

firstKey()

Get the first key of the Hashtable.

Returns:
Type Description

The first key of the Hashtable, or undefined if empty.

Source:

get(key)

Get a value corresponding to a key, or undefined if not found.

Parameters:
Name Type Description
key

The key associated to the value.

Source:

keys(result)

Dump all the keys of the Hashtable to an array (which is cleared first).

Parameters:
Name Type Description
result

The Array where the result gets pushed.

Source:

put(key, value)

Add a key-value pair to the Hashtable. If a value already exists for this key, it is overwritten.

Parameters:
Name Type Description
key

The key.

value

The value to associate to the key.

Source:

remove(key)

Remove the value associated to the specified key.

Parameters:
Name Type Description
key

The key to remove.

Source:

values(result)

Dump all the values of the Hashtable to an array (which is cleared first).

Parameters:
Name Type Description
result

The Array where the results get pushed.

Source: