Erase¶
Name | Mandatory | Description | Default | Type |
---|---|---|---|---|
⬅️ Input |
Any input is ignored. | Any |
||
Output ➡️ |
The input to this shard is passed through as its output. | Any |
||
Indices |
No | One or multiple indices to filter from a sequence. | none |
Any Var(Any) |
Name |
No | The name of the variable. | `` | String Var(Any) |
Key |
No | The key of the value to erase from the table (nested table). | none |
Any |
Global |
No | If the variable is or should be available to all of the wires in the same mesh. | false |
Bool |
Deletes specific elements from a sequence or keys from a table.
Details¶
The Indices
parameter specifies which elements or keys to remove from the target sequence or table. For example, Erase(Indices: [0 1] Name: sequence)
removes the elements at indices 0 and 1 from a sequence, while Erase(Indices: ["key1" "key2"] Name: table) deletes the keys "key1" and "key2" (and their values)
from a table.
The Key
parameter identifies which key contains the value to be modified. The value associated with this key must itself be a table or a sequence.
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 drop elements from.
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 40 |
|
[info] Set - Warning: setting an already exposed variable "seq", use Update to avoid this warning.
[info] Set - Warning: setting an already exposed variable "tab", use Update to avoid this warning.
[info] [sample-wire] output: [100 300 400]
[info] [sample-wire] seq1: [100 300 400]
[info] [sample-wire] [200 400]
[info] [sample-wire] {k1: 10 k3: 30}
[info] [sample-wire] {k2: 200}
[info] [sample-wire] [2]
[info] [sample-wire] [1 3]
[info] [sample-wire] {k2: 2}
[info] [sample-wire] {k1: 1 k3: 3}