Skip to content

Table

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. `` String&Any
Key Yes 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
Type No The table type to forward declare. None NoneType

Creates an empty table. Useful to declare and specify types.

Details

Table creates an empty table with or without a specified key (via the Key parameter). The created table name is defined in the Name parameter.

Whether the created table variable has a global scope (available to all wires on the mesh) or a local scope (available only to the wire its defined in) can be controlled via the Global parameter (true for global scope, false for local scope; default is false).

In addition to the key and the scope, this shard can also define the table'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.

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, using `Push` (puts sequence values)
; ; Table(:Name tableA)
; ; tableA | Log        ;; created a table => {A: []}
1 | Push(tableA "A")
tableA | Log ; ; updated table => {A: [1]}
2 | Push(tableA "A")
tableA | Log ; ; updated table => {A: [1, 2]}

; ; with key, single type, global scope, using `Set`
Table(tableB Key: "A" Global: true Type: @type({A: Type::Float}))
tableB | Log ; ; created a table => {A: {}}
10.2 | Set(tableB "A")
tableB | Log ; ; updated table => {A: 10.2}
20.1 | Set(tableB "A")
tableB | Log ; ; updated table => {A: 20.1}

; ; with key, multiple types, local scope, using `Set`
Table(tableC Key: "A" Type: @type({A: Type::Float B: Type::Int}))
tableC | Log ; ; created a table => {A: {}}
10.3 | Set(tableC "A")
tableC | Log ; ; updated table => {A: 10.3}
20 | Set(tableC "B")
tableC | Log ; ; updated table => {B: 20, A: 10.3}

; ; with key, single type, local scope, using `Push` (puts sequence values)
; ; Table(tableD Key: "A" Type:s Type.Int)
; ; tableD | Log        ;; created a table => {A: []}
10 | Push(tableD "A")
tableD | Log ; ; updated table => {A: [10]}
20 | Push(tableD "A")
tableD | Log