https://powdertoy.co.uk/Wiki/index.php?action=history&feed=atom&title=Lua_API%3AToolsLua API:Tools - Revision history2024-12-22T20:56:52ZRevision history for this page on the wikiMediaWiki 1.30.0https://powdertoy.co.uk/Wiki/index.php?title=Lua_API:Tools&diff=9427&oldid=prevjacob1: Add to Lua category2024-12-15T05:12:56Z<p>Add to Lua category</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 05:12, 15 December 2024</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l29" >Line 29:</td>
<td colspan="2" class="diff-lineno">Line 29:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>You can get an identifier by selecting it and checking ui.activeTool(0). Every selectable tool is available in tools.index for lookup.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>You can get an identifier by selecting it and checking ui.activeTool(0). Every selectable tool is available in tools.index for lookup.</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:Lua]]</ins></div></td></tr>
<!-- diff cache key mediawiki-pw_:diff:version:1.11a:oldid:9426:newid:9427 -->
</table>jacob1https://powdertoy.co.uk/Wiki/index.php?title=Lua_API:Tools&diff=9426&oldid=prevjacob1: Start tools api documentation (99.0)2024-12-15T05:12:00Z<p>Start tools api documentation (99.0)</p>
<p><b>New page</b></p><div>The <code>tools</code> API contains methods for creating and reading properties of custom tools and built-in tools.<br />
<br />
"Tools" in a general sense refers to any selectable tool in the game, including elements, tools, walls, and decoration tools. If you can select it and it gets a red border around it, it's a tool, and you can read its properties with this API.<br />
<br />
Most of the usefulness of the API comes from creating custom tools. Custom tools receive the same callbacks as everything in the Tools menu. They interact with locations the user is drawing the brush at.<br />
<br />
== Methods ==<br />
<br />
=== tools.allocate ===<br />
<br />
=== tools.free ===<br />
<br />
=== tools.property ===<br />
<br />
=== tools.exists ===<br />
<br />
=== tools.isCustom ===<br />
<br />
== Constants ==<br />
<br />
=== tools.index ===<br />
<br />
A table that maps Identifiers to their tool indices.<br />
<pre>airTool = tools.index.DEFAULT_TOOL_AIR</pre><br />
<br />
Tool indicies are arbitrary and not guaranteed to be constant for any particular tool between versions.<br />
<br />
The identifiers for all built-in and custom tools are in this table. The format for an Identifier depends on the type of tool. It is roughly <code>[group]_[type]_[name]</code>, where [group] is DEFAULT for built-in tools, and [type] could be PT, TOOL, WL, or more depending on the type.<br />
<br />
You can get an identifier by selecting it and checking ui.activeTool(0). Every selectable tool is available in tools.index for lookup.</div>jacob1