Update¶
Name | Mandatory | Description | Default | Type |
---|---|---|---|---|
⬅️ Input |
The value to be set to the variable. | Any |
||
Output ➡️ |
The input value is passed through as the output. | Any |
||
Name |
No | The name of the variable. | `` | String Var(Any) |
Key |
No | The key of the value to read from the table (parameter applicable only if the target variable is a table). | none |
Any |
Global |
No | If the variable is available to all of the wires in the same mesh. | false |
Bool |
Modifies the value of an existing mutable variable.
Details¶
Update
replaces string, numeric, and sequence variables with the new value (coming from input). The updated value however must be of the same type as the original value.
Also, for an existing table, Update
can only replace the existing keys' values. It cannot add new key-value pairs to the table (do that with Set
). To replace existing key-values in a table you need to pass the key in the Key
parameter.
Since variables may be locally scoped (created with (Global: false)
; exists only for current wire) or globally scoped (created with (Global: true)
; exists for all wires of that mesh), both parameters Global
and Name
are used in combination to identify the correct variable to update.
Note
Update
has an alias >
.
Examples¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
[info] [sample-wire] .svar: Hello
[info] [sample-wire] modified .svar: World
[info] [sample-wire] .nvar: 100
[info] [sample-wire] modified .nvar: 200
[info] [sample-wire] .sequence: [100]
[info] [sample-wire] .table1: {key1: [a b]}
[info] [sample-wire] .table1: {key1: [def]}
[info] [sample-wire] .svarA: Hello
[info] [sample-wire] modified .svar: World
[info] [sample-wire] {key1: [a b]}
[info] [sample-wire] {key1: [c d]}
[info] [sample-wire] {key1: [X]}
[info] [sample-wire] {key1: [Y]}