LIST
Command: #list {variable} {option} {argument}
#list {var} {add} <items> Add <items> to the list
#list {var} {clear} Empty the given list
#list {var} {collapse} <separator> Turn list into a variable
#list {var} {copy} <variable> Copy variable to the list
#list {var} {create} <items> Create a list using <items>
#list {var} {delete} <index> [amount] Delete the item at <index>,
the [amount] is optional.
#list {var} {explode} <separator> Turn variable into a list
#list {var} {indexate} [key] Index a list table for sorting
#list {var} {insert} <index> <item> Insert <item> at given index
#list {var} {filter} <keep> [remove] Filter with keep / remove regex
#list {var} {find} <regex> <variable> Return the found index
#list {var} {get} <index> <variable> Copy an item to {variable}
#list {var} {numerate} Renumber a table or list
#list {var} {order} [items] Sort list alphanumerically
#list {var} {refine} <keep> [remove] Filter with keep / remove math
with &0 holding the value
#list {var} {reverse} Reverse the list
#list {var} {shuffle} Shuffle the list
#list {var} {set} <index> <item> Change the item at {index}
#list {var} {simplify} [items] Turn list into a simple list
#list {var} {size} <variable> Copy list size to {variable}
#list {var} {sort} [items] Sort list alphabetically, if
an item is given it's added.
#list {var} {swap} <index> <index> Swap two items
#list {var} {tokenize} <string> Create a character list
The index should be between +1 and the list's size. You can also give
a negative value, in which case -1 equals the last item in the list,
-2 the second last, etc.
When inserting an item a positive index will prepend the item at the
given index, while a negative index will append the item.
The add and create options allow using multiple items, as well
as semicolon separated items.
The get option will return the item or the indexation. Use
$var[<index>] to retrieve the nested data of a list table.
The order, sort and simplify options will perform the operation on
the given list. Optional items can be provided which are added to
the new or existing list before the operation is executed. Sorting
and ordering are stable.
The indexate option prepares a table or list table for order, sort,
filter, refine, and find operations for the given key. It is similar
to the SELECT option in SQL. All entries must contain the given key.
A size of 0 is returned for an empty or non-existent list. You can
directly access the size of a list using &var[].
You can directly access elements in a list variable using $var[+1],
$var[+2], $var[-1], etc.
Related: break, continue, foreach, loop, parse, repeat, return and while.
|