- This wiki is out of date, use the continuation of this wiki instead
Glob
From FenixWiki
Contents |
Definition
INT glob ( <STRING criteria> )
Gets a single filename matching the criteria and keeps returning new ones on subsequent calls until it can't find any more, in which case it returns "". To restart the search, a call to frame() is needed, in which case frame(0); can come in handy.
Parameters
| STRING criteria | - Search criteria: the folder in which you want to look, as well as any simple requirements for filenames such as extensions. |
Returns
STRING : Filename
| "" | - No (new) file entries. |
| !"" | - The filename of a file entry matching the search criteria. |
Example
Program files;
Private
String filename;
Begin
// method one:
Loop
filename = Glob("levels\*.tul"); // Looks for a file in the relative folder
// "levels" that has the file extension "tul".
if(filename!="")
load_level(filename); // load_level() would load the level file
else
Break;
end
End
// method two:
While( (filename = Glob("levels\*.tul")) != "" )
load_level(filename);
End
End
Both method result in the same, but the second one is less code.
