PDA

View Full Version : File.Find Error Help Plis


kankan
06-16-2009, 12:48 PM
-- Gets the path to the user's My Documents folder.
my_docs_path = Dialog.FolderBrowse("Selecciona :", "C:\\");

if
my_docs_path =="CANCEL" then

else
sFile = File.Find(my_docs_path, "*.txt", true, false, nil, nil);
for i, value in sFile do
Paragraph.SetText("Paragraph1", String.AbbreviateFilePath(value, 45)); ---path progress in text

end

if (sFile== nil) then

else


result = Dialog.Message("Notice", "found.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

end
Paragraph.SetText("Paragraph1", "end...");
end


The problem occurs when looking for a disc which contains *. txt or a blank disc is click on the following error, line 21: attemp to call to nil value, some help please


sorry my English is very bad, I speak Spanish

ShadowUK
06-16-2009, 01:04 PM
If File.Find can't find anything, It returns a nil value. This means you should check if the type of the return value is a table or not.