summaryrefslogtreecommitdiff
path: root/Lua API.html
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-06-14 12:46:12 +0400
committerAlexander Gavrilov2012-06-14 12:46:12 +0400
commit7eb4fc19de542db0d3e271123f24773e0c8c481e (patch)
tree027f53970a8333eac7e33079c297c7b87754a333 /Lua API.html
parent2781723f7bf2bef87b7c6c5252aebd6392cbefbf (diff)
downloaddfhack-7eb4fc19de542db0d3e271123f24773e0c8c481e.tar.gz
dfhack-7eb4fc19de542db0d3e271123f24773e0c8c481e.tar.bz2
dfhack-7eb4fc19de542db0d3e271123f24773e0c8c481e.tar.xz
Make dfhack.run_script usable from other scripts, and document it.
Diffstat (limited to 'Lua API.html')
-rw-r--r--Lua API.html10
1 files changed, 10 insertions, 0 deletions
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.</p>
<li><p class="first"><tt class="docutils literal"><span class="pre">dfhack.saferesume(coroutine[,args...])</span></tt></p>
<p>Compares to coroutine.resume like dfhack.safecall vs pcall.</p>
</li>
+<li><p class="first"><tt class="docutils literal"><span class="pre">dfhack.run_script(name[,args...])</span></tt></p>
+<p>Run a lua script in hack/scripts/, as if it was started from dfhack command-line.
+The <tt class="docutils literal">name</tt> 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.</p>
+</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">dfhack.with_suspend(f[,args...])</span></tt></p>
<p>Calls <tt class="docutils literal">f</tt> with arguments after grabbing the DF core suspend lock.
Suspending is necessary for accessing a consistent state of DF memory.</p>
@@ -1310,6 +1316,10 @@ Returns <em>true, was_only_planned</em> if removed; or <em>false</em> if none fo
<p>These functions are intended for the use by dfhack developers,
and are only documented here for completeness:</p>
<ul>
+<li><p class="first"><tt class="docutils literal">dfhack.internal.scripts</tt></p>
+<p>The table used by <tt class="docutils literal">dfhack.run_script()</tt> to give every script its own
+global environment, persistent between calls to the script.</p>
+</li>
<li><p class="first"><tt class="docutils literal">dfhack.internal.getAddress(name)</tt></p>
<p>Returns the global address <tt class="docutils literal">name</tt>, or <em>nil</em>.</p>
</li>