lovr.filechanged

Edit

The lovr.filechanged callback is called when a file is changed. File watching must be enabled, either by passing --watch when starting LÖVR or by calling lovr.filesystem.watch.

Currently, only files in the source directory are watched. On Android, files in the sdcard directory are watched.

function lovr.filechanged(path, action, oldpath)
  -- your code here
end

Arguments

NameTypeDescription
pathstring The path to the file that changed.
actionFileAction What happened to the file.
oldpathstring The old path, for rename actions.

Returns

Nothing

Notes

LÖVR provides a default implementation for lovr.filechanged that restarts the project if a non-hidden file was changed:

function lovr.filechanged(path)
  if not path:match('^%.') then
    lovr.event.restart()
  end
end

See also