09.05.2021, 09:30
1. If the script is working properly then you should have only one file before it runs. Since you have meter values that cannot become smaller you can check if the current object value is smaller than the new value before writing:
2. size, mtime = io.stat(path) where mtime is file modification timestamp, it can be converted to any date/time format using os.date(fmt, mtime)
3. You need to add grp.write() calls yourself after values = line:trim():split(','), values[1] is the first CSV row entry, values[2] is the second and so on
4. Each os.remove(path) removes a single file, path variable already contains full path (dir .. '/' .. file)
5. There's no defined order, you can add table.sort(files) after files = io.ls(dir) to sort the files table before going through all files
Code:
value = tonumber(...)
addr = ...
if value and value > grp.getvalue(addr) then
grp.write(addr, value)
end
2. size, mtime = io.stat(path) where mtime is file modification timestamp, it can be converted to any date/time format using os.date(fmt, mtime)
3. You need to add grp.write() calls yourself after values = line:trim():split(','), values[1] is the first CSV row entry, values[2] is the second and so on
4. Each os.remove(path) removes a single file, path variable already contains full path (dir .. '/' .. file)
5. There's no defined order, you can add table.sort(files) after files = io.ls(dir) to sort the files table before going through all files