Return to index

notify functions

notify_event = ev_event(watcher)

top

Sample events in watcher. Returns an event or nil.

Example:

# Example for ev_event
var e=ev_event(watcher)
println e  # Event struct with .Name and .Op fields


bool = ev_exists(watcher)

top

True if watcher should still be available for use.

Example:

# Example for ev_exists
println ev_exists(watcher)  # true/false


filename_or_nil = ev_mask(notify_event,str_event_type)

top

Is notify_event of type str_event_type? str_event_type can be one of create, write, remove, rename or chmod.

Example:

# Example for ev_mask
watch,code=ev_watch("/tmp")
ev=ev_event(watch)
if ev_mask(ev,"create")!=nil
  println "File created"
endif


watcher,int_error_code = ev_watch(filepath_string)

top

Initialise a file system watch object. Returns the new watcher and 0 error code on success,

[#SOL]otherwise nil and >0 code. 1->create_watcher_failed, 2->file_path_failure

Example:

# Example for ev_watch
var w,code=ev_watch("/tmp")
println w,code  # watcher object, 0


int_error_code = ev_watch_add(watcher,filepath_string)

top

Add another file path to watcher. Returns 0 on success, otherwise >0 code. e.g. 13->file permissions.

Example:

# Example for ev_watch_add
watch,code=ev_watch("/tmp")
ev_watch_add(watch,"/var")


bool = ev_watch_close(watcher)

top

Dispose of a watcher object.

Example:

# Example for ev_watch_close
ev_watch_close(w)


int_error_code = ev_watch_remove(watcher,filepath_string)

top

Remove an existing file path in watcher. Returns 0 on success, otherwise >0 code.

Example:

# Example for ev_watch_remove
watch,code=ev_watch("/tmp")
ev_watch_remove(watch,"/tmp")