Callback
Signature
void onFileChange(string filepath, table stats, bool created, bool deleted)
Description
The callback function that is executed when a file change has been detected.
Arguments
File Path
The absolute path of the changed file.
Stats
A table with file stats.
Type
Name
Description
u64
Mode
Bit mask for file-mode information. A list of constants can be found below.
u64
Size
Size in bytes.
u64
Atime
Time of last access.
u64
CTime
Time of creation.
u64
Mtime
Time of last modification.
Created
Set to true
if the file was created or renamed.
Deleted
Set to true
if the file was deleted or renamed.
Example
Reload Config When Changed
local function onFileChange(filepath, stats, created, deleted)
if deleted then
return
end
local filename = filepath:match("^.+/(.+)$")
if filename == "inventory-config.lua" then
--reload inventory
elseif filename == "stats-config.lua" then
--reload stats
end
end
event.registerFileChangeHandler("scripts/config/mymod/*.lua", onFileChange)
Notes
Modes
Name
Bit Mask
Description
_S_IEXEC
0x0040
Execute/search permission, owner.
_S_IWRITE
0x0080
Write permission, owner.
_S_IREAD
0x0100
Read permission, owner.
_S_IFIFO
0x1000
Pipe.
_S_IFCHR
0x2000
Character special.
_S_IFDIR
0x4000
Directory.
_S_IFREG
0x8000
Regular.
_S_IFMT
0xF000
File type mask.
Last updated