Guest User

Untitled

a guest
Feb 9th, 2022
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. -- write to file when exiting the player or switching file
  2.         function on_file_end(event)
  3.             local message = totaltime .. "s, " .. timeloaded .. filename
  4.             local file = io.open(logpath, "a")
  5.             local lines = {}
  6.             if not paused then totaltime = totaltime + os.clock() - lasttime end
  7.             if file_exists(logpath) then
  8.                 for l in file:lines() do
  9.                 if not l:find(message, 1, true) then
  10.                 lines[#lines+1] = l
  11.                 file:write(message)
  12.             end
  13.         end
  14.         file:close()
  15.         mp.osd_message("test")
  16.     end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment