From AOLserver Wiki
Revision as of 17:08, 7 October 2005 by Dossy (talk | contribs) (category link fixup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Man page:


keylget - Return value associated with key from the keyed list in listvar


keylget listvar ?key? ?retvar | {}?


This command returns the value associated with key from the keyed list in the variable listvar. If retvar is not specified, then the value will be returned as the result of the command. In this case, if key is not found in the list, an error will result.
If retvar is specified and key is in the list, then the value is returned in the variable retvar and the command returns 1. Otherwise, the command will return 0, and retvar will be left unchanged.
If retvar is an empty string, the value is not returned, allowing the Tcl programmer to determine if a key is present in a keyed list without setting a variable as a side-effect.
If key is omitted, then a list of all the keys in the keyed list is returned similar to keylkeys.
Keyed lists are an extension of Tcl provided by the TclX package. They are an alternative to using ns_set, but we highly recommend using ns_set instead of keyed lists. The commands provided by AOLserver were taken directly from a 1995 version of the TclX package.


   % keylset mylist a b c d e f
   % keylget mylist
   a c e
   % keylget mylist c
   % keylget mylist nokey
   key "nokey" not found in keyed list
   % keylget mylist nokey test
   % keylget mylist a test
   % set test


TclX [1], keyldel, keylkeys, keylset