Update lua_api.html

master
rubenwardy 2016-05-26 18:47:50 +01:00
parent 0884f744fc
commit adb67ac396
1 changed files with 26 additions and 8 deletions

View File

@ -4,10 +4,11 @@ layout: default
---
<div class='notice'>
<h2>This is lua_api.txt nicely formated: I did not write this</h2>
This page was last updated 09/April/2016.<br />See <a href="https://github.com/minetest/minetest/blob/master/doc/lua_api.txt">doc/lua_api.txt</a> for the latest version (in plaintext).<br />Generated using <a href="https://github.com/rubenwardy/minetest_modding_book/blob/gh-pages/update_lua_api.py">a Python script</a>.</div>
This page was last updated 26/May/2016.<br />See <a href="https://github.com/minetest/minetest/blob/master/doc/lua_api.txt">doc/lua_api.txt</a> for the latest version (in plaintext).<br />Generated using <a href="https://github.com/rubenwardy/minetest_modding_book/blob/gh-pages/update_lua_api.py">a Python script</a>.</div>
<h2 id="table-of-contents">Table of Contents</h2>
<div class="toc">
<ul>
<li><a href="#minetest-lua-modding-api-reference-0414">Minetest Lua Modding API Reference 0.4.14</a><ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#programming-in-lua">Programming in Lua</a></li>
<li><a href="#startup">Startup</a></li>
@ -42,6 +43,7 @@ This page was last updated 09/April/2016.<br />See <a href="https://github.com/m
<li><a href="#advanced-texture-modifiers">Advanced texture modifiers</a><ul>
<li><a href="#cracknp">[crack:&lt;n&gt;:&lt;p&gt;</a></li>
<li><a href="#combinewxhx1y1file1x2y2file2">[combine:&lt;w&gt;x&lt;h&gt;:&lt;x1&gt;,&lt;y1&gt;=&lt;file1&gt;:&lt;x2&gt;,&lt;y2&gt;=&lt;file2&gt;:...</a></li>
<li><a href="#resizewxh">[resize:&lt;w&gt;x&lt;h&gt;</a></li>
<li><a href="#brighten">[brighten</a></li>
<li><a href="#noalpha">[noalpha</a></li>
<li><a href="#makealphargb">[makealpha:&lt;r&gt;,&lt;g&gt;,&lt;b&gt;</a></li>
@ -346,8 +348,10 @@ This page was last updated 09/April/2016.<br />See <a href="https://github.com/m
</ul>
</li>
</ul>
</li>
</ul>
</div>
<h1 id="minetest-lua-modding-api-reference-0414">Minetest Lua Modding API Reference 0.4.14</h1>
<h2 id="introduction">Introduction</h2>
<p>Content and functionality can be added to Minetest 0.4 by using Lua
scripting in run-time loaded mods.</p>
@ -361,7 +365,7 @@ source code patches to <a href="mailto:celeron55@gmail.com">celeron55@gmail.com<
<ul>
<li>More information at <a href="http://www.minetest.net/">http://www.minetest.net/</a></li>
<li>Developer Wiki: <a href="http://dev.minetest.net/">http://dev.minetest.net/</a></li>
</ul>This page was last updated 09/April/2016.<br/>See <a href="https://github.com/minetest/minetest/blob/master/doc/lua_api.txt">doc/lua_api.txt</a> for the latest version (in plaintext).<br/>Generated using <a href="https://github.com/rubenwardy/minetest_modding_book/blob/gh-pages/update_lua_api.py">a Python script</a>.<h2 id="programming-in-lua">Programming in Lua</h2>
</ul>This page was last updated 26/May/2016.<br/>See <a href="https://github.com/minetest/minetest/blob/master/doc/lua_api.txt">doc/lua_api.txt</a> for the latest version (in plaintext).<br/>Generated using <a href="https://github.com/rubenwardy/minetest_modding_book/blob/gh-pages/update_lua_api.py">a Python script</a>.<h2 id="programming-in-lua">Programming in Lua</h2>
<p>If you have any difficulty in understanding this, please read
<a href="http://www.lua.org/pil/">Programming in Lua</a>.</p>
<h2 id="startup">Startup</h2>
@ -543,7 +547,8 @@ to generate textures on-the-fly.</p>
<p>Example:</p>
<pre><code>default_dirt.png^default_grass_side.png
</code></pre>
<p><code>default_grass_side.png</code> is overlayed over <code>default_dirt.png</code>.</p>
<p><code>default_grass_side.png</code> is overlayed over <code>default_dirt.png</code>.
The texture with the lower resolution will be automatically upscaled to the higher resolution texture.</p>
<h3 id="texture-grouping">Texture grouping</h3>
<p>Textures can be grouped together by enclosing them in <code>(</code> and <code>)</code>.</p>
<p>Example: <code>cobble.png^(thing1.png^thing2.png)</code></p>
@ -572,6 +577,11 @@ specified coordinates.</p>
<p>Example:</p>
<pre><code>[combine:16x32:0,0=default_cobble.png:0,16=default_wood.png
</code></pre>
<h4 id="resizewxh"><code>[resize:&lt;w&gt;x&lt;h&gt;</code></h4>
<p>Resizes the texture to the given dimensions.</p>
<p>Example:</p>
<pre><code>default_sandstone.png^[resize:16x16
</code></pre>
<h4 id="brighten"><code>[brighten</code></h4>
<p>Brightens the texture.</p>
<p>Example:</p>
@ -841,9 +851,9 @@ paramtype2 == "facedir"
^ The rotation of the node is stored in param2. Furnaces and chests are
rotated this way. Can be made by using minetest.dir_to_facedir().
Values range 0 - 23
facedir modulo 4 = axisdir
facedir / 4 = axis direction:
0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y-
facedir's two less significant bits are rotation around the axis
facedir modulo 4 = rotation around that axis
paramtype2 == "leveled"
paramtype2 == "degrotate"
^ The rotation of this node is stored in param2. Plants are rotated this way.
@ -1159,6 +1169,7 @@ in the experimental stages.</p>
<li><a class="anchor" href="#number_2" name="number_2">#</a><code>number</code>: Number of items in the inventory to be displayed.</li>
<li><a class="anchor" href="#item" name="item">#</a><code>item</code>: Position of item that is selected.</li>
<li><a class="anchor" href="#direction_1" name="direction_1">#</a><code>direction</code></li>
<li><a class="anchor" href="#offset_4" name="offset_4">#</a><code>offset</code>: offset in pixels from position.</li>
</ul>
<h3 id="waypoint"><code>waypoint</code></h3>
<p>Displays distance to selected world position.</p>
@ -2154,7 +2165,8 @@ or string form, a ColorString (defined above):
<li><a class="anchor" href="#hp_change" name="hp_change">#</a><code>hp_change</code>: the amount of change. Negative when it is damage.</li>
<li><a class="anchor" href="#modifier" name="modifier">#</a><code>modifier</code>: when true, the function should return the actual hp_change.
Note: modifiers only get a temporary hp_change that can be modified by later modifiers.
modifiers can return true as a second argument to stop the execution of further functions.</li>
modifiers can return true as a second argument to stop the execution of further functions.
Non-modifiers receive the final hp change calculated by the modifiers.</li>
</ul>
</li>
<li><a class="anchor" href="#minetestregister_on_respawnplayerfuncObjectRef" name="minetestregister_on_respawnplayerfuncObjectRef">#</a><code>minetest.register_on_respawnplayer(func(ObjectRef))</code><ul>
@ -2233,6 +2245,7 @@ or string form, a ColorString (defined above):
<li><a class="anchor" href="#minetestregister_privilegenamedefinition" name="minetestregister_privilegenamedefinition">#</a><code>minetest.register_privilege(name, definition)</code><ul>
<li><a class="anchor" href="#definition" name="definition">#</a><code>definition</code>: <code>"description text"</code></li>
<li><a class="anchor" href="#definition_1" name="definition_1">#</a><code>definition</code>: <code>{ description = "description text", give_to_singleplayer = boolean, -- default: true }</code></li>
<li>To allow players with basic_privs to grant, see basic_privs minetest.conf setting.</li>
</ul>
</li>
<li><a class="anchor" href="#minetestregister_authentication_handlerhandler" name="minetestregister_authentication_handlerhandler">#</a><code>minetest.register_authentication_handler(handler)</code><ul>
@ -2528,7 +2541,9 @@ and <code>minetest.auth_reload</code> call the authetification handler.</p>
</ul>
</li>
<li><a class="anchor" href="#minetestspawn_treepostreedef" name="minetestspawn_treepostreedef">#</a><code>minetest.spawn_tree (pos, {treedef})</code><ul>
<li><a class="anchor" href="#pos_1" name="pos_1">#</a>spawns L-System tree at given <code>pos</code> with definition in <code>treedef</code> table</li>
<li><a class="anchor" href="#pos_1" name="pos_1">#</a>spawns L-system tree at given <code>pos</code> with definition in <code>treedef</code> table</li>
<li>Warning: L-system generation currently creates lighting bugs in the form of mapblock-sized shadows.
Often these bugs appear as subtle shadows in water.</li>
</ul>
</li>
<li><a class="anchor" href="#minetesttransforming_liquid_addpos" name="minetesttransforming_liquid_addpos">#</a><code>minetest.transforming_liquid_add(pos)</code><ul>
@ -3881,6 +3896,9 @@ numeric unique decoration ID.</p>
</li>
</ul>
<h2 id="l-system-trees">L-system trees</h2>
<p><strong>Warning</strong>
L-system generation currently creates lighting bugs in the form of mapblock-sized shadows.
Often these bugs appear as subtle shadows in water.</p>
<h3 id="tree-definition">Tree definition</h3>
<pre><code>treedef={
axiom, --string initial tree axiom