$list total

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
$list total is a [[Variable Functions|Variable 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.
+
$list total is a [[Data Functions|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.
 
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.
  

Revision as of 15:01, 11 April 2013

$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.


Example

The list total function is used to set a limit for how many times the commands in the loop command can 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.

File:0listtotal.png

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.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox