$List_Print
Display contents of a $list
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $List_Print function is the Print function.
This function displays the contents of a $list on the user's standard output device, typically a terminal.
$List_Print accepts five arguments and returns a numeric result. It is a callable $function.
Syntax
[%result =] $List_Print(listid, num_len, len_len, first_item, max_items)
%result | A numeric value that is set to the number of $list items displayed. All errors result in request cancellation. |
---|---|
listid | The $list identifier of the input $list. This is a required argument. |
num_len | The number of bytes in the display of each line to use for the item number. This must be a number between 0 and 10 inclusive and, if greater than 0, a blank is placed after the item number.
Item numbers are right-justified in the indicated number of bytes. and they are truncated on the left if the length of the item number exceeds the space allocated for it. This optional argument defaults to 0, which means the item numbers will not be displayed. |
len_len | The number of bytes in the display of each line to use for the item length. This must be a number between 0 and 4 inclusive and, if greater than 0, a blank is placed after the item length.
Item lengths are right-justified in the indicated number of bytes, and they are truncated on the left if the length of the item length exceeds the space allocated for it. This optional argument defaults to 0, which means the item lengths will not be displayed. |
first_item | The first item number to display. This optional argument defaults to 1. |
max_items | The maximum number of items to display. A zero or negative value means to display all items to the end of the $list.
This optional argument defaults to zero, which means display to the end of the $list. |
Usage notes
- $List_Print, as its name would suggest, is functionally equivalent to a Print statement, except that $list items longer than 255 bytes are displayed in their entirety. Any output redirection or capturing, whether it be a USE command, a $List_Capture, or a $Sock_Capture, will apply to the output of a $List_Print.
- If the input $list for a $List_Print is also the current output target of a $List_Capture, only the $list items that are on the $list before the $List_Print is issued will be displayed and appended to its own end.
Example
This code fragment would populate the $list %list
with 1024 $list items that each contain "I will not talk out of turn in class":
%list = $ListNew %rc = $List_Capture(%list) Print 'I will not talk out of turn in class' For %i From 1 To 10 %rc = $List_Print(%list) End For %rc = $List_Capture