Array

An ordered list of values (string, number or other object). Arrays are strings, that are interpreted as arrays if the value is enclosed by square brackets ([a,b]).

Arrays have specific semantics for how they are used, depending on the situation and they should be interpreted. Each format implies the interpretation of the value:

  • Array

    An array is a list of items, separated by commas, and surrounded by square brackets. For example:

    logscale
    ["Hello","World"]

    In this context, the array has no name. If the array had the name greeting, then the Arrayname is greeting[].

  • Arrayname

    When referring to the name of the array (and therefore the array and all its values), the format is always the name of the field followed by a pair of square brackets. For example, to interpret the field flags as flags[].

  • Array Element

    An array element is a single element from the array. For example the array:

    logscale
    greeting := ["Hello","World"]

    The array element greeting[0] is the string Hello.

Arrays themselves do not have a type, and an array can be an array of any values or objects. The following is a valid array:

logscale
["Hello","World",3.141,{ names=* }]
Creating arrays with different content types
logscale
colors := ["red", "green", "blue"]
ports := [80, 443, 8080]
mixed := ["server1", 192, true]
Using arrays in functions
logscale
concat(["First", "Middle", "Last"], separator=" ")

Functions using this Type: array:dedup(), dropEvent(), eval(), fieldset()