![]() |
uvi-script
Musical event scripting with Lua
|
An Asynchronous task that lists the files of a folder. More...
Public Attributes | |
| table | result |
| array of entries, empty when the folder could not be listed. | |
| string | error |
| why the folder could not be listed ("folder not found: ..."), nil on success. | |
Public Attributes inherited from AsyncTask | |
| int | id |
| unique identifier for this task | |
| bool | finished |
| a flag to indicate whether the task has been completed. Also true after the task was cancelled: check success or state. | |
| float | progress |
| a value between 0 and 1 to be notified of the task's progress. | |
| bool | success |
| a flag to indicate whether the task has been successful. | |
| string | state |
| a string to indicate the current task state (pending | running | finished | cancelled) | |
Additional Inherited Members | |
Public Member Functions inherited from AsyncTask | |
| void | cancel () |
| notify the task that it should be cancelled. | |
An Asynchronous task that lists the files of a folder.
Tasks returned by listFiles().
Each entry of result is a table:
path: absolute path of the file or foldername: file name, extension includedisDirectory: true for a folder (folders are listed only when the patterns are "")size: size in bytes, 0 for a foldermodified: last modification time, in seconds since 1970-01-01 UTC (0 inside a sound bank)Entries are sorted by path, byte order: "B.json" comes before "a.json".
Example:
See the UserPresetBrowser example for a complete user preset manager (listFiles, saveData, loadData and browseForFile).
| table AsyncListFilesTask::result |
array of entries, empty when the folder could not be listed.
Each read builds a new table: keep it in a local rather than reading it in a loop.