CFileList:Next


The Next method returns the next file name from the file list in the CFileList object.

Syntax

sFileName = CFindFiles:Next()

bullet.gif    sFileName is the next file name in the file list.

bullet.gif    Returns nil when the end of the file list is reached.

Remarks

This method iterates to the next file in the file list. When the end is reached, nil is returned. Call Start to go back to the beginning of the file list.

Example

The following script creates a CFileList object from the file named sFileName. Then it iterates through the file list, returning each name from the list. Note that Next returns the next file name as a string, so you should not hide its return value by using it as a loop counter.

F = new_filelist( sFileName )

-- Create a new CFileList from the file sFileName

while n = 1, F:Count() do

-- step through the file list

  str = F:Next()

-- save the next file name

  Printf("%s\r\n", str )

-- list the file name

  -- do something with the file name

 

end

 

Related Topics

CFileList, Open, Start, new_filelist


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.