PDA

View Full Version : Documentation error? win.CreateFolderWatcher



Rob H
April 2nd, 2005, 01:56 PM
According to the help


FWatcherObj = win.CreateFolderWatcher ( string EventString, int EventDevice, string Folder, int Flags, int Recursive);


I'm calling it like this :

local folderWatcher = win.CreateFolderWatcher('LDJ_FOLDER_CHANGE', 18, dir, 31, 1)
But I get the following error:


bad argument #3 to 'CreateFolderWatcher' (number expected got string)

BTW it would be nice if the logger could hold more lines (it seems to be limited to 49) and also had a copy function. Oh, and a timestamp would be good too while I'm at it.

Promixis
April 2nd, 2005, 03:35 PM
Rob,

I just found that last night. Will fix it shortly.

Mike

Rob H
April 2nd, 2005, 04:01 PM
But what's the correct parameter order?

Ron
April 2nd, 2005, 04:36 PM
And here is the update with the parameters according to the documentation.

There is also new functionality, function calling instead of events.


function FolderChanged ()

print ("Folder changed")

end

local FolderWatcher = win.CreateFolderWatcher (win.GetDirectory ("GIRDERDIR"),FolderChanged,383,1)


Have fun.

Rob H
April 2nd, 2005, 04:45 PM
Thanks Ron.

Is the function call in addition to the event? ie pass a string if you want an event or pass a function if you want a function/

Promixis
April 2nd, 2005, 05:04 PM
--[[

FolderWatcher = win.CreateFolderWatcher (folder,eventstring,deviceid,flags,recursive)

OR

FolderWatcher = win.CreateFolderWatcher (folder,function,flags,recursive)

FolderWatcher is non nil if successful

--]]

function FolderChanged ()

print ("Folder changed")

end

local FolderWatcher = win.CreateFolderWatcher (win.GetDirectory ("GIRDERDIR"),FolderChanged,383,1)

local file = assert(io.open(win.GetDirectory ("GIRDERDIR").."\\text.txt", "w"))

file:write ("testing folder watcher")

file:close ()

Rob H
April 21st, 2005, 06:36 AM
Just a little reminder to update the help to reflect this change