Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local FolderBit = 2 ^ (5 - 1);
- --Filter should be E:/*.* or equal, func params; string path, string file, bool isfolder
- --FORWARDSLASHES not backslashes
- local function Files(filter,func)
- local file, attrib = nwn.GetFirstFile( filter );
- local folders = {};
- local index = string.find(filter, "/[^/]*$");
- local path = filter:sub(1,index);
- local ext = filter:sub(index);
- while file do
- --Its a folder
- if attrib % (FolderBit + FolderBit) >= FolderBit then
- if file~="." and file~=".." then
- func(path,file,true);
- table.insert(folders,file);
- end
- else
- func(path,file,false);
- end
- file, attrib = nwn.GetNextFile( );
- end
- for n=1,#folders do
- file = path..folders[n]..ext;
- Files(file,func);
- end
- end
- return Files;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement