$list total

From UBot Playground
Jump to: navigation, search

$list total is a Data Function. A list's contents are numbered by their position starting from position 0.

This function will return the total number of items in a list.

The function is often used along with the loop command, which allows the loop to loop according to the number of items are within the list.

List: The desired populated list.


The list total function is used to set a limit for how many times the commands in the loop cycles if items in a list are being used within the loop.

add list to list(%my list, $list from text("hello,hi,how are ya", ","), "Delete", "Global")
set list position(%my list, 0)
loop($list total(%my list)){alert($next list item(%my list))}

Notice that there are three items separated by the comma in our list, which is populated using the list from text function.


Running the script will bring up an alert for each list item. The loop will stop after the last list item is presented in the alert command.