From 7eb4fc19de542db0d3e271123f24773e0c8c481e Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Thu, 14 Jun 2012 12:46:12 +0400 Subject: Make dfhack.run_script usable from other scripts, and document it. --- Lua API.html | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Lua API.html') diff --git a/Lua API.html b/Lua API.html index 5574c55b..04745798 100644 --- a/Lua API.html +++ b/Lua API.html @@ -766,6 +766,12 @@ returning. Intended as a convenience function.
dfhack.saferesume(coroutine[,args...])
Compares to coroutine.resume like dfhack.safecall vs pcall.
dfhack.run_script(name[,args...])
+Run a lua script in hack/scripts/, as if it was started from dfhack command-line. +The name argument should be the name stem, as would be used on the command line. +Note that the script is re-read from the file every time it is called, and errors +are propagated to the caller.
+dfhack.with_suspend(f[,args...])
Calls f with arguments after grabbing the DF core suspend lock. Suspending is necessary for accessing a consistent state of DF memory.
@@ -1310,6 +1316,10 @@ Returns true, was_only_planned if removed; or false if none foThese functions are intended for the use by dfhack developers, and are only documented here for completeness:
dfhack.internal.scripts
+The table used by dfhack.run_script() to give every script its own +global environment, persistent between calls to the script.
+dfhack.internal.getAddress(name)
Returns the global address name, or nil.