beetlebug▾
/

tsv set

Sets or gives the value of an element of a shared array.

tsv::set ARRAY ELEMENT ?VALUE?

Description

The command tsv::set sets the element ELEMENT of the shared array ARRAY to VALUE and gives VALUE. It makes the array and the element when they do not exist. With no VALUE, it gives the value of the element, as tsv::get does.

Arguments

ArgumentTypeDefaultDescription
ARRAYarray namerequiredThe name of the shared array.
ELEMENTstringrequiredThe name of the element.
VALUEstringnoneThe new value.

Returns

The value of the element.

Examples

% tsv::set cfg mode fast
fast

% tsv::set cfg mode fast
> tsv::set cfg mode
fast

Errors

% tsv::set a
wrong # args: should be "tsv::set array key ?args?"
-errorcode TCL WRONGARGS

% tsv::set nope x
"nope" is not a thread shared array
-errorcode NONE

% tsv::set a x 1
> tsv::set a nope
no key a(nope)
-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

See also