Length of an arbitrary wavelist?

I'm writing a thing that looks at all the waves in a folder, then makes a wavelist of waves whose names meet certain criteria so I can do operations and plot them. The problem is that I don't always know how many waves meet that criteria, so I don't know how long the wavelist is. Sometimes it's one, sometimes two, three, five, etc.

What's a good way to loop over a wavelist of unknown size?

I'm assuming that, by wavelist, you mean a list of wave names in a string such as "wave0;wave1;wave2;".

Here is an example from the help topic "Displaying a Multi-Selection Open File Dialog":

Variable numFilesSelected = ItemsInList(outputPaths, "\r")
    Variable i
    for(i=0; i<numFilesSelected; i+=1)
        String path = StringFromList(i, outputPaths, "\r")
        Printf "%d: %s\r", i, path 
    endfor

If the list is very long, there is a faster method of iteration. See the help for StringFromList for an example.

Depending on your application, you may want to use a wave reference wave which is a wave containing references to other waves.:

DisplayHelpTopic "Wave Reference Waves"