Function: gethash

gethash is a function defined in fns.c.

Signature

(gethash KEY TABLE &optional DEFAULT)

Documentation

Look up KEY in TABLE and return its associated value.

If KEY is not found in table, return DEFAULT, or nil if DEFAULT is not provided.

Other relevant functions are documented in the hash-table group.

View in manual

Probably introduced at or before Emacs version 21.1.

Shortdoc

;; hash-table
(gethash 'key table)
    e.g. => "value"

Aliases

cl-gethash (obsolete since 24.3)

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
  struct Lisp_Hash_Table *h = check_hash_table (table);
  ptrdiff_t i = hash_find (h, key);
  return i >= 0 ? HASH_VALUE (h, i) : dflt;
}