problem: I am extending a lua script engine. I would like the engine to be able to detect at runtime if a script has been modified and if so reload it. However I don't know how to detect if a file has been modified.

my idea: My idea was that whenever I run/load the script I use c++'s file handing functions to get a timestamp of when the file was last modified. This timestamp is then compared with the former timestamp (unless it is the first time) and saved as the new timestamp. However I have not been able to find any kind of support for such timestamps in my books or on the web.

Any help or pointer would be appriciated.

thanks in advance

8 Years
Discussion Span
Last Post by Nick Evan

In that case use inotify. With inotify you can check in your program if changes have been made to a directory or file. No need for manual timestamp checking whatsoever! Example program is on page I linked to.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.