setd_default

Definition: setd_default(object o, tid=1)
Description: Override the default result (initially NULL) for getd() when a key is not found.

o: the new default value, can be any valid object.
tid: a result from new_dict(), or if omitted it uses the one common dictionary.
Comments: Since it is legal to store any valid object as the data, there may be no default that unequivocably means "missing key" when returned by getd(), in which case you must use getd_index()==0 instead. In other words this routine is only useful when the existing default of 0 is getting in the way, and you have a valid alternative that will never clash with anything else that you might store.

The default can only be set per-dictionary (ideally as created), since obviously any blanket alterations to the defaults could easily cripple otherwise perfectly working third party components, that rely on 0s.
Example:
integer patterns = new_dict()
setd(-1,patterns)
?getd("?",patterns) -- prints -1
See Also: new_dict, getd, getd_index