|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > LST. - List Arrays > List-Operations > Smart Package Robot (SPR) List Commands |
MiniRobotLanguage (MRL)
LST.Prev
Get the handle to the previous node in the list
Intention
The LST.Prev command is used to retrieve the handle of the previous node in a list relative to the current node. This is particularly useful when traversing a list in reverse order or when you need to access the previous element in a sequence.
The command requires the handle of the current node and optionally stores the handle of the previous node in a specified variable. If the previous node does not exist (e.g., at the start of the list), the result will be 0.
Syntax
LST.Prev|$$LST|$$NOD[|$$RES]
Parameter Explanation
$$LST - The list identifier, typically a numeric value or a variable that contains a valid list handle.
$$NOD - The handle of the current node in the list.
$$RES - (Optional) The variable to store the handle of the previous node. If omitted, the result is placed on the Top of Stack (TOS).
Example
'***********************************
' LST.Prev Sample Script
'***********************************
' Create a new list
LST.New|$$LST
' Add elements to the list
LST.Add|$$LST|Hello
LST.Add|$$LST|World
' Get the last node
LST.Last|$$LST|$$NOD
' Get the previous node
LST.Prev|$$LST|$$NOD|$$RES
' Print the result
DBP. Previous node handle: $$RES
' Clean up
LST.End|$$LST
ENR.
Remarks
-
Limitations:
- The list must be initialized and contain at least one node.
See also:
• LST.First - Get First Node in List
• LST.Next - Get Next Node in List