Skip to content

Sequence

Name Mandatory Description Default Type
⬅️ Input Any input is ignored. Any
Output ➡️ The input to this shard is passed through as its output. Any
Name No The name of the variable. `` StringVar(Any)
Key No The key of the value to write in 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
Clear No If we should clear this sequence at every wire iteration; works only if this is the first push; default: true. true Bool
Type No The sequence type to forward declare. none NoneType

Creates an empty sequence (or sequence in a table if a key is passed). Useful to declare and specify types.

Details

Sequence creates an empty sequence when the :Key parameter is not set. If a key is passed via this parameter Sequence creates an empty table instead (behaving like the Table shard). The created sequence name is defined in the :Name parameter.

This shard can control the scope of the created sequence variable. A true value for the :Global parameter makes the scope of the sequence global (available to all wires on the mesh), and a false value makes the scope local (available only to the wire its defined in).

By default a sequence created with this shard would be cleared (emptied) every time the wire is executed (since :Clear is true by default). To retain the sequence values across wire iterations set the :Clear parameter to false.

This shard can also define the sequence's inner data types via the :Types parameter. More than one data type may be set.

Any input to this shard is ignored and instead passed through as its output.

See also

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
; without key, without types, local scope, Clear: true, using Push
Sequence(Name: seqA)
seqA | Log ; created an empty sequence => []
1 | Push(seqA)
seqA | Log ; updated sequence => [1]
2 | Push(seqA)
seqA | Log ; updated sequence => [1, 2]

; with key (becomes table), single type, global scope, Clear: true, using Set
Sequence(seqB Key: "A" Global: true Type: @type([Type::Float]))
seqB | Log ; created an empty table => {A: []}
10.2 | Set(seqB "A")
seqB | Log ; updated table => {A: 10.2}
20.1 | Set(seqB "A")
seqB | Log ; updated table => {A: 20.1}

; without key, multiple types, local scope, Clear: false, using Push
Sequence(seqC Type: @type([Type::Float Type::Int]) Clear: false)
seqC | Log ; created an empty sequence => []
10.3 | Push(seqC)
seqC | Log ; updated sequence => [10.3]
20 | Push(seqC)
seqC | Log ; updated sequence => [10.3, 20]

; with key (becomes table), single type, local scope, Clear: true, using Push
Sequence(seqD Key: "A" Type: @type([Type::Int]))
seqD | Log ; created an empty table => {A: []}
10 | Push(seqD "A")
seqD | Log ; updated table => {A: [10]}
20 | Push(seqD "A")
seqD | Log ; updated table => {A: [10, 20]}

[info] [sample-wire] []
[info] [sample-wire] [1]
[info] [sample-wire] [1 2]
[info] [sample-wire] {A: []}
[info] [sample-wire] {A: 10.2}
[info] [sample-wire] {A: 20.1}
[info] [sample-wire] []
[info] [sample-wire] [10.3]
[info] [sample-wire] [10.3 20]
[info] [sample-wire] {A: []}
[info] [sample-wire] {A: [10]}
[info] [sample-wire] {A: [10 20]}