Skip to content

DropFront

Name Mandatory Description Default Type
⬅️ Input Any input is ignored. Any
Output ➡️ The input is passed through as the output. Any
Name No The name of the variable. `` StringVar(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

Drops the first element of the sequence variable. Works only on sequences. If the variable is not a sequence, it simply passes through without failing.

Details

DropFront drops (removes) the first element of the sequence variable that has been passed to in the :Name parameter.

This shard works on both sequences and tables. Parameter :Key applies only to tables.

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.

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
; drop first element from a local sequence
[10 20 30 40] >= seq           ; create a local sequence
Get(seq) | Log                ; local sequence => [10, 20, 30, 40]
DropFront(Name: seq)          ; drops the first element i.e., 10
Get(seq) | Log                ; updated sequence => [20 30 40]

; drop first element from a same-name global sequence
[11 21 31 41] | Set(seq Global: true)  ; create global sequence
Get(seq Global: true) | Log   ; global sequence => [11, 21, 31, 41]
DropFront(Name: seq Global: true)   ; drops the first element i.e., 11
Get(seq Global: true) | Log   ; updated sequence => [21, 31, 41]

[info] Set - Warning: setting an already exposed variable "seq", use Update to avoid this warning.
[info] [sample-wire] [10 20 30 40]
[info] [sample-wire] [20 30 40]
[info] [sample-wire] [11 21 31 41]
[info] [sample-wire] [21 31 41]