lovr.filechanged
EditThe 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
endArguments
| Name | Type | Description |
| path | string | The path to the file that changed. |
| action | FileAction | What happened to the file. |
| oldpath | string |
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