Watching $lists, Stringlists, and Arraylists: Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 17: Line 17:
| <span class="f_DefListDD">Gets the value of a particular list item.</span>
| <span class="f_DefListDD">Gets the value of a particular list item.</span>
|}
|}
</div>
</div>
: Where:
: Where:
Line 39: Line 37:
| <span class="f_DefListDD">Gets the value of a particular list item.</span>
| <span class="f_DefListDD">Gets the value of a particular list item.</span>
|}
|}
</div>
</div>
: Where:
: Where:

Latest revision as of 17:56, 25 April 2023

To inspect $lists, Stringlists, and Arraylists, you apply additional $functions or object methods to the $list, Stringlist, or Arraylist variable in the text box above the Watch Window. Otherwise, the Debugger will merely report whether or not these variables have content.

This section describes how to watch individual list items or list counts. Using a related technique, you can display all the list items and their values at once.

To watch $lists, Stringlists, or Arraylists:

$listcnt(listID Gets the number of items in the list
$listinf(listID,subscript) Gets the value of a particular list item.
Where:
  • listID is a $list identifier, most often a Float variable. It must be a simple variable or a constant; it may not be an image item or a %variable array item, for example.
  • subscript is a 1 based list item subscript that identifies the item to watch.

 

  • For Stringlists or Arraylists, specify either of the following in the Entity name input box for the %list Stringlist or Arraylist object variable:
%list:count Gets the number of items in the list
%list:item(num) Gets the value of a particular list item.
Where:
  • %list is a Stringlist or Arraylist object variable.
  • num is a 1 based positive integer that identifies the item to watch. It must be a simple variable or a constant; it may not be an image item or a %variable array item, for example.

For example, here are the results of watching the function specifications $LISTCNT(%G), $LISTINF(%G, 1), $LISTINF(%G, 2), and $LISTINF(%G, 3):

watchList1a  

The contents of the Watch Window, above, result from evaluating the following test program:

INCLUDE LISTTEXT b   %i is float   %g is float   %g = $listnew   %i = 777   $listadd(%g, 'All work and no play')   $listadd(%g, ' makes Jack a dull boy.')   $list_print(%g) end