$list total
(One intermediate revision by one user not shown) | |||
Line 10: | Line 10: | ||
== Example == | == Example == | ||
− | The list total function is used to set a limit for how many times the commands in the loop | + | 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. |
<pre>add list to list(%my list, $list from text("hello,hi,how are ya", ","), "Delete", "Global") | <pre>add list to list(%my list, $list from text("hello,hi,how are ya", ","), "Delete", "Global") | ||
Line 19: | Line 19: | ||
Notice that there are three items separated by the comma in our list, which is populated using the [[$list from text|list from text function]]. | Notice that there are three items separated by the comma in our list, which is populated using the [[$list from text|list from text function]]. | ||
− | [[File: | + | [[File:yryr.jpg]] |
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|alert command]]. | 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|alert command]]. |
Latest revision as of 17:03, 27 December 2016
$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.
[edit] Example
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.