tsv keylget
Gives the value of a key of a keyed list in a shared array.
tsv::keylget ARRAY ELEMENT ?KEY? ?VARNAME?
Description
The command tsv::keylget gives the value of KEY in the keyed list of the element. A KEY with dots is a path. With VARNAME, it gives 1 and puts the value in the variable when the key exists, and gives 0 when it does not. With no KEY, it gives the keys of the top level, as tsv::keylkeys does.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| ARRAY | array name | required | The name of the shared array. |
| ELEMENT | string | required | The name of the element. |
| KEY | key, or a path of keys with dots | none | The key to read. |
| VARNAME | variable name | none | The variable for the value. |
Returns
The value, 1 or 0 with VARNAME, or a list of keys with no KEY.
Examples
% tsv::keylset k e name Ann a.b 1
> tsv::keylget k e name
Ann
% tsv::keylset k e name Ann a.b 1
> tsv::keylget k e a.b
1
% tsv::keylset k e name Ann
> list [tsv::keylget k e name v] $v [tsv::keylget k e nope w]
1 Ann 0
% tsv::keylset k e3 name Ann age 30
> tsv::keylget k e3
name age
Errors
% tsv::keylset k e name Ann
> tsv::keylget k e nope
key "nope" not found
-errorcode NONE
% tsv::keylget nope e name
"nope" is not a thread shared array
-errorcode NONE
Facts
- Capability
thread. A new interpreter does not have it until the host turns it on.- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1