In logic, a
List is similar to an
one-dimensional array but without a defined size. That is, a List is a collection of values, either numeric or string, that can grow or shrink in size.
A List is a CSPro logic object and the following functions can be called via
dot notation:
Function | Description |
add | Adds a single value, or a List of values, to the end of a List. |
clear | Removes all values from the List. |
insert | Inserts a single value, or a List of values, at a given position in the List. |
length | Returns the size of the List. |
remove | Removes the value at a given position from the List. |
removeDuplicates | Removes duplicate values from the List. |
removeIn | Removes values from the List that are specified in an in list. |
seek | Returns the index of a specified value. |
show | Displays the List object's values (similarly to accept) and returns the index of the operator's selection. |
sort | Sorts the List object's values in ascending or descending order. |
|
getLabel | Returns the symbol's label. |
getName | Returns the symbol's name. |
getJson | Returns the symbol's metadata and value represented in JSON. |
getValueJson | Returns the symbol's value represented in JSON. |
updateValueFromJson | Modifies the symbol based on a JSON representation of the value. |
In addition to these object functions, List objects can be filled when used as arguments to functions such as
dirlist,
keylist, and
HashMap.getKeys.
List objects can be assigned to other List objects, which will replace the initial List with the values of the assigned List:
list_name = another_list_name;
Individual elements of List objects can also be modified or added by using a one-based index:
list_name(index) = modify_value;
list_name(list_name.length() + 1) = add_value;