$previous list item

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
 
(2 intermediate revisions by one user not shown)
Line 7: Line 7:
 
So instead of looping through a list from position 0 to position 9, you loop through it  
 
So instead of looping through a list from position 0 to position 9, you loop through it  
 
from position 9 to position 0.
 
from position 9 to position 0.
 +
 +
 +
'''List:''' The desired populated list where the previous list item will be pulled from.
  
  
Line 17: Line 20:
 
}
 
}
 
</pre>
 
</pre>
 +
  
 
Setting the list position to 3 informs the list to start from list position 3 and decrements by two list position. The loop set to 2 will allow the previous list function to only decrement by two list positions.
 
Setting the list position to 3 informs the list to start from list position 3 and decrements by two list position. The loop set to 2 will allow the previous list function to only decrement by two list positions.
  
[[File:previous.png]]
 
  
[[File:previous1.png]]
+
[[File:uhy8.jpg]]
 +
 
 +
[[File:uhy9.jpg]]
 +
 
  
 
== Additional Information ==
 
== Additional Information ==
 +
 
The list positions are 0 based. If you have 6 items in a list, the 0 based list will number the list items from 0-5, not 1-6.
 
The list positions are 0 based. If you have 6 items in a list, the 0 based list will number the list items from 0-5, not 1-6.

Latest revision as of 21:06, 27 December 2016

$previous list item is a Data Function. The function returns the list item at the list's current position and decrements the list's position.

This function works exactly the same as $next list position except you would work from the end of a list and work up it.

So instead of looping through a list from position 0 to position 9, you loop through it from position 9 to position 0.


List: The desired populated list where the previous list item will be pulled from.


[edit] Example

add list to list(%my list, $list from text("list item 1, list item 2,list item 3, list item 4,list item 5,list item 6", ","), "Delete", "Global")
set list position(%my list, 3)
loop(2) {
    alert($previous list item(%my list))
}


Setting the list position to 3 informs the list to start from list position 3 and decrements by two list position. The loop set to 2 will allow the previous list function to only decrement by two list positions.


Uhy8.jpg

Uhy9.jpg


[edit] Additional Information

The list positions are 0 based. If you have 6 items in a list, the 0 based list will number the list items from 0-5, not 1-6.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox