tsv keylset
Sets keys of a keyed list in a shared array.
tsv::keylset ARRAY ELEMENT KEY VALUE ?KEY VALUE ...?
Description
The command tsv::keylset sets each KEY of the keyed list in the element to its VALUE. A keyed list is a list of pairs of a key and a value, such as {name Ann} {age 30}. A KEY with dots, such as a.b, is a path: the value of a is a keyed list with the key b. An element that does not exist starts as an empty keyed list.
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 | required | The key to set. |
| VALUE | string | required | The value of the key. |
Returns
An empty string.
Examples
% tsv::keylset k e name Ann
> tsv::keylset k e age 30 city Paris
> tsv::get k e
{name Ann} {age 30} {city Paris}
% tsv::keylset k e2 a.b 1
> tsv::get k e2
{a {{b 1}}}
Errors
% tsv::keylset
wrong # args: should be "tsv::keylset array key ?args?"
-errorcode TCL WRONGARGS
% tsv::keylset k e x
wrong # args: should be "tsv::keylset k e key value ?key value ...?"
-errorcode TCL WRONGARGS
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