diff --git a/Lua API.html b/Lua API.html index aa41b8b63..e5318165d 100644 --- a/Lua API.html +++ b/Lua API.html @@ -404,7 +404,10 @@ ul.auto-toc {
The current version of DFHack has extensive support for @@ -1034,6 +1037,9 @@ can be omitted.
dfhack.getHackPath()
Returns the dfhack directory path, i.e. ".../df/hack/".
dfhack.getSavePath()
+Returns the path to the current save directory, or nil if no save loaded.
+dfhack.getTickCount()
Returns the tick count in ms, exactly as DF ui uses.
Note that this function lets errors propagate to the caller.
+If a save directory contains a file called raw/init.lua, it is +automatically loaded and executed every time the save is loaded. It +can also define the following functions to be called by dfhack:
+function onStateChange(op) ... end
+Automatically called from the regular onStateChange event as long +as the save is still loaded. This avoids the need to install a hook +into the global dfhack.onStateChange table, with associated +cleanup concerns.
+function onUnload() ... end
+Called when the save containing the script is unloaded. This function +should clean up any global hooks installed by the script.
+Within the init script, the path to the save directory is available as SAVE_PATH.
+