|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > LST. - List Arrays > List-Management > Smart Package Robot 's List Commands |
MiniRobotLanguage (MRL)
LST.Count
Get the number of items in a container
Intention
The LST.Count command retrieves the number of items (elements) in a container. This is useful for determining the size of a container before processing its contents.
The command takes two parameters: the handle of the container and an optional variable to store the result. If the result variable is omitted, the count is placed on the top of the stack (TOS).
Syntax
LST.Count|P1|P2
Parameter Explanation
P1 - The handle of the container. This is typically a variable that contains the handle of the container.
P2 - (Optional) The variable to store the number of items in the container. If omitted, the result is placed on the top of the stack (TOS).
Example
'***********************************
' LST.Count Sample
'***********************************
' Create a new list and add some elements
LST.New|$$LST
LST.Add|$$LST|Hello
LST.Add|$$LST|World
LST.Add|$$LST|!
' Get the number of items in the list
LST.Count|$$LST|$$CNT
DBP.Number of items: $$CNT
' End the script
ENR.
Remarks
-
Limitations:
- The container must exist and be valid.
See also:
• LST.Add - Add Element to List
• LST.TextLoad - Load Text File into Container