Function

GLib-2.0GLibhash_table_insert

  • Inserts a new key and value into a GLib.HashTable.

    If the key already exists in the GLib.HashTable its current value is replaced with the new value. If you supplied a value_destroy_func when creating the GLib.HashTable, the old value is freed using that function. If you supplied a key_destroy_func when creating the GLib.HashTable, the passed key is freed using that function.

    Starting from GLib 2.40, this function returns a boolean value to indicate whether the newly added value was already in the hash table or not.

    Parameters

    • hash_table: GLib.HashTable<any, any> | { [key: string]: any }
    • Optionalkey: any

      a key to insert

    • Optionalvalue: any

      the value to associate with the key

    Returns boolean

    true if the key did not exist yet