Next: , Previous: , Up: Utilities   [Contents][Index]


4.6.2 Live Reloading

(use-modules (sly utils live-reload))

The live-reload module enables Sly programs to react to changes in the file system and reload assets automatically, which is useful when using external programs such as an image editor or map editor. This makes it easy to see the changes made to game assets quickly.

Function: live-reload proc [polling-interval]

Return a new procedure that re-applies proc whenever the associated file is modified. The new procedure returns a signal (see Signals) that contains the return value of proc. The first argument to proc must be a file name string.

A simple polling method is used to test for updates. Files are polled every polling-interval ticks (120 by default).