Update lua_api.html

This commit is contained in:
rubenwardy 2016-07-22 19:37:58 +01:00
parent de7276c3dc
commit a50ab100cd

View File

@ -4,7 +4,7 @@ layout: default
---
<div class='notice'>
<h2>This is lua_api.txt nicely formated: I did not write this</h2>
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>
This page was last updated 22/July/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>
@ -191,7 +191,7 @@ This page was last updated 26/May/2016.<br />See <a href="https://github.com/min
<li><a href="#tabheaderxynamecaption-1caption-2caption-ncurrent_tabtransparentdraw_border">tabheader[&lt;X&gt;,&lt;Y&gt;;&lt;name&gt;;&lt;caption 1&gt;,&lt;caption 2&gt;,...,&lt;caption n&gt;;&lt;current_tab&gt;;&lt;transparent&gt;;&lt;draw_border&gt;]</a></li>
<li><a href="#boxxywhcolor">box[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;color&gt;]</a></li>
<li><a href="#dropdownxywnameitem-1item-2-item-nselected-idx">dropdown[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;;&lt;name&gt;;&lt;item 1&gt;,&lt;item 2&gt;, ...,&lt;item n&gt;;&lt;selected idx&gt;]</a></li>
<li><a href="#checkboxxynamelabelselectedtooltip">checkbox[&lt;X&gt;,&lt;Y&gt;;&lt;name&gt;;&lt;label&gt;;&lt;selected&gt;;&lt;tooltip&gt;]</a></li>
<li><a href="#checkboxxynamelabelselected">checkbox[&lt;X&gt;,&lt;Y&gt;;&lt;name&gt;;&lt;label&gt;;&lt;selected&gt;]</a></li>
<li><a href="#scrollbarxywhorientationnamevalue">scrollbar[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;orientation&gt;;&lt;name&gt;;&lt;value&gt;]</a></li>
<li><a href="#tablexywhnamecell-1cell-2cell-nselected-idx">table[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;cell 1&gt;,&lt;cell 2&gt;,...,&lt;cell n&gt;;&lt;selected idx&gt;]</a></li>
<li><a href="#tableoptionsopt-1opt-2">tableoptions[&lt;opt 1&gt;;&lt;opt 2&gt;;...]</a></li>
@ -203,6 +203,7 @@ This page was last updated 26/May/2016.<br />See <a href="https://github.com/min
<li><a href="#inventory-locations">Inventory locations</a></li>
<li><a href="#colorstring">ColorString</a></li>
<li><a href="#colorspec">ColorSpec</a></li>
<li><a href="#escape-sequences">Escape sequences</a></li>
<li><a href="#spatial-vectors">Spatial Vectors</a></li>
<li><a href="#helper-functions">Helper functions</a></li>
<li><a href="#minetest-namespace-reference">minetest namespace reference</a><ul>
@ -343,8 +344,8 @@ This page was last updated 26/May/2016.<br />See <a href="https://github.com/min
<li><a href="#hud-definition-hud_add-hud_get">HUD Definition (hud_add, hud_get)</a></li>
<li><a href="#particle-definition-add_particle">Particle definition (add_particle)</a></li>
<li><a href="#particlespawner-definition-add_particlespawner">ParticleSpawner definition (add_particlespawner)</a></li>
<li><a href="#httprequest-definition-http_fetch-http_fetch_async">HTTPRequest definition (http_fetch, http_fetch_async)</a></li>
<li><a href="#httprequestresult-definition-http_fetch-callback-http_fetch_async_get">HTTPRequestResult definition (http_fetch callback, http_fetch_async_get)</a></li>
<li><a href="#httprequest-definition-httpapitablefetch_async-httpapitablefetch_async">HTTPRequest definition (HTTPApiTable.fetch_async, HTTPApiTable.fetch_async)</a></li>
<li><a href="#httprequestresult-definition-httpapitablefetch-callback-httpapitablefetch_async_get">HTTPRequestResult definition (HTTPApiTable.fetch callback, HTTPApiTable.fetch_async_get)</a></li>
</ul>
</li>
</ul>
@ -365,7 +366,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 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>
</ul>This page was last updated 22/July/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>
@ -416,12 +417,16 @@ the <code>init.lua</code> scripts in a shared environment.</p>
<p>The game directory can contain the file minetest.conf, which will be used
to set default settings when running the particular game.
It can also contain a settingtypes.txt in the same format as the one in builtin.
This settingtypes.txt will be parsed by the menu and the settings will be displayed in the "Games" category in the settings tab.</p>
This settingtypes.txt will be parsed by the menu and the settings will be displayed
in the "Games" category in the settings tab.</p>
<h3 id="menu-images">Menu images</h3>
<p>Games can provide custom main menu images. They are put inside a <code>menu</code> directory inside the game directory.</p>
<p>The images are named <code>$identifier.png</code>, where <code>$identifier</code> is one of <code>overlay,background,footer,header</code>.
If you want to specify multiple images for one identifier, add additional images named like <code>$identifier.$n.png</code>, with an ascending number $n starting with 1,
and a random image will be chosen from the provided ones.</p>
<p>Games can provide custom main menu images. They are put inside a <code>menu</code> directory
inside the game directory.</p>
<p>The images are named <code>$identifier.png</code>, where <code>$identifier</code> is
one of <code>overlay,background,footer,header</code>.
If you want to specify multiple images for one identifier, add additional images named
like <code>$identifier.$n.png</code>, with an ascending number $n starting with 1, and a random
image will be chosen from the provided ones.</p>
<h2 id="mod-load-path">Mod load path</h2>
<p>Generic:</p>
<ul>
@ -548,7 +553,8 @@ to generate textures on-the-fly.</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>.
The texture with the lower resolution will be automatically upscaled to the higher resolution texture.</p>
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>
@ -763,8 +769,8 @@ the global <code>minetest.registered_*</code> tables.</p>
<li><a class="anchor" href="#minetestregistered_schematic" name="minetestregistered_schematic">#</a>added to <code>minetest.registered_schematic</code> with the key of <code>schematic.name</code></li>
<li><a class="anchor" href="#schematicname" name="schematicname">#</a>if <code>schematic.name</code> is nil, the key is the returned ID</li>
<li>if the schematic is loaded from a file, schematic.name is set to the filename</li>
<li>if the function is called when loading the mod, and schematic.name is a relative path,</li>
<li>then the current mod path will be prepended to the schematic filename</li>
<li>if the function is called when loading the mod, and schematic.name is a relative
path, then the current mod path will be prepended to the schematic filename</li>
</ul>
</li>
<li><a class="anchor" href="#minetestclear_registered_biomes" name="minetestclear_registered_biomes">#</a>
@ -1579,15 +1585,15 @@ list[current_player;craftpreview;7,1;1,1;]
<h4 id="listringinventory-locationlist-name"><code>listring[&lt;inventory location&gt;;&lt;list name&gt;]</code></h4>
<ul>
<li>Allows to create a ring of inventory lists</li>
<li>Shift-clicking on items in one element of the ring</li>
<li>will send them to the next inventory list inside the ring</li>
<li>The first occurrence of an element inside the ring will</li>
<li>determine the inventory where items will be sent to</li>
<li>Shift-clicking on items in one element of the ring
will send them to the next inventory list inside the ring</li>
<li>The first occurrence of an element inside the ring will
determine the inventory where items will be sent to</li>
</ul>
<h4 id="listring"><code>listring[]</code></h4>
<ul>
<li><a class="anchor" href="#listringinventorylocationlistname" name="listringinventorylocationlistname">#</a>Shorthand for doing <code>listring[&lt;inventory location&gt;;&lt;list name&gt;]</code></li>
<li>for the last two inventory lists added by list[...]</li>
<li><a class="anchor" href="#listringinventorylocationlistname" name="listringinventorylocationlistname">#</a>Shorthand for doing <code>listring[&lt;inventory location&gt;;&lt;list name&gt;]</code>
for the last two inventory lists added by list[...]</li>
</ul>
<h4 id="listcolorsslot_bg_normalslot_bg_hover"><code>listcolors[&lt;slot_bg_normal&gt;;&lt;slot_bg_hover&gt;]</code></h4>
<ul>
@ -1650,7 +1656,7 @@ list[current_player;craftpreview;7,1;1,1;]
<li>Textual password style field; will be sent to server when a button is clicked</li>
<li><a class="anchor" href="#x_1" name="x_1">#</a><code>x</code> and <code>y</code> position the field relative to the top left of the menu</li>
<li><a class="anchor" href="#w_1" name="w_1">#</a><code>w</code> and <code>h</code> are the size of the field</li>
<li><a class="anchor" href="#h_1" name="h_1">#</a>fields are a set height, but will be vertically centred on <code>h</code></li>
<li><a class="anchor" href="#h_1" name="h_1">#</a>Fields are a set height, but will be vertically centred on <code>h</code></li>
<li>Position and size units are inventory slots</li>
<li><a class="anchor" href="#name_2" name="name_2">#</a><code>name</code> is the name of the field as returned in fields to <code>on_receive_fields</code></li>
<li><a class="anchor" href="#label" name="label">#</a><code>label</code>, if not blank, will be text printed on the top left above the field</li>
@ -1660,7 +1666,7 @@ list[current_player;craftpreview;7,1;1,1;]
<li>Textual field; will be sent to server when a button is clicked</li>
<li><a class="anchor" href="#x_2" name="x_2">#</a><code>x</code> and <code>y</code> position the field relative to the top left of the menu</li>
<li><a class="anchor" href="#w_2" name="w_2">#</a><code>w</code> and <code>h</code> are the size of the field</li>
<li><a class="anchor" href="#h_2" name="h_2">#</a>fields are a set height, but will be vertically centred on <code>h</code></li>
<li><a class="anchor" href="#h_2" name="h_2">#</a>Fields are a set height, but will be vertically centred on <code>h</code></li>
<li>Position and size units are inventory slots</li>
<li><a class="anchor" href="#name_3" name="name_3">#</a><code>name</code> is the name of the field as returned in fields to <code>on_receive_fields</code></li>
<li><a class="anchor" href="#label_1" name="label_1">#</a><code>label</code>, if not blank, will be text printed on the top left above the field</li>
@ -1673,14 +1679,14 @@ list[current_player;craftpreview;7,1;1,1;]
</ul>
<h4 id="fieldnamelabeldefault"><code>field[&lt;name&gt;;&lt;label&gt;;&lt;default&gt;]</code></h4>
<ul>
<li>as above, but without position/size units</li>
<li>special field for creating simple forms, such as sign text input</li>
<li><a class="anchor" href="#size_2" name="size_2">#</a>must be used without a <code>size[]</code> element</li>
<li>a "Proceed" button will be added automatically</li>
<li>As above, but without position/size units</li>
<li>Special field for creating simple forms, such as sign text input</li>
<li><a class="anchor" href="#size_2" name="size_2">#</a>Must be used without a <code>size[]</code> element</li>
<li>A "Proceed" button will be added automatically</li>
</ul>
<h4 id="textareaxywhnamelabeldefault"><code>textarea[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;label&gt;;&lt;default&gt;]</code></h4>
<ul>
<li>same as fields above, but with multi-line input</li>
<li>Same as fields above, but with multi-line input</li>
</ul>
<h4 id="labelxylabel"><code>label[&lt;X&gt;,&lt;Y&gt;;&lt;label&gt;]</code></h4>
<ul>
@ -1755,13 +1761,13 @@ list[current_player;craftpreview;7,1;1,1;]
<li>if you want a listelement to start with "#" write "##"</li>
</ul>
</li>
<li>index to be selected within textlist</li>
<li>Index to be selected within textlist</li>
<li><a class="anchor" href="#true_2" name="true_2">#</a><code>true</code>/<code>false</code>: draw transparent background</li>
<li><a class="anchor" href="#minetestexplode_textlist_event" name="minetestexplode_textlist_event">#</a>see also <code>minetest.explode_textlist_event</code> (main menu: <code>engine.explode_textlist_event</code>)</li>
<li><a class="anchor" href="#minetestexplode_textlist_event" name="minetestexplode_textlist_event">#</a>See also <code>minetest.explode_textlist_event</code> (main menu: <code>engine.explode_textlist_event</code>)</li>
</ul>
<h4 id="tabheaderxynamecaption-1caption-2caption-ncurrent_tabtransparentdraw_border"><code>tabheader[&lt;X&gt;,&lt;Y&gt;;&lt;name&gt;;&lt;caption 1&gt;,&lt;caption 2&gt;,...,&lt;caption n&gt;;&lt;current_tab&gt;;&lt;transparent&gt;;&lt;draw_border&gt;]</code></h4>
<ul>
<li>show a tab<strong>header</strong> at specific position (ignores formsize)</li>
<li>Show a tab<strong>header</strong> at specific position (ignores formsize)</li>
<li><a class="anchor" href="#x_11" name="x_11">#</a><code>x</code> and <code>y</code> position the itemlist relative to the top left of the menu</li>
<li><a class="anchor" href="#name_6" name="name_6">#</a><code>name</code> fieldname data is transferred to Lua</li>
<li><a class="anchor" href="#caption1" name="caption1">#</a><code>caption 1</code>...: name shown on top of tab</li>
@ -1771,38 +1777,37 @@ list[current_player;craftpreview;7,1;1,1;]
</ul>
<h4 id="boxxywhcolor"><code>box[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;color&gt;]</code></h4>
<ul>
<li>simple colored semitransparent box</li>
<li>Simple colored semitransparent box</li>
<li><a class="anchor" href="#x_12" name="x_12">#</a><code>x</code> and <code>y</code> position the box relative to the top left of the menu</li>
<li><a class="anchor" href="#w_6" name="w_6">#</a><code>w</code> and <code>h</code> are the size of box</li>
<li><a class="anchor" href="#color" name="color">#</a><code>color</code> is color specified as a <code>ColorString</code></li>
</ul>
<h4 id="dropdownxywnameitem-1item-2-item-nselected-idx"><code>dropdown[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;;&lt;name&gt;;&lt;item 1&gt;,&lt;item 2&gt;, ...,&lt;item n&gt;;&lt;selected idx&gt;]</code></h4>
<ul>
<li>show a dropdown field</li>
<li>Show a dropdown field</li>
<li><strong>Important note</strong>: There are two different operation modes:<ol>
<li>handle directly on change (only changed dropdown is submitted)</li>
<li>read the value on pressing a button (all dropdown values are available)</li>
</ol>
</li>
<li><a class="anchor" href="#x_13" name="x_13">#</a><code>x</code> and <code>y</code> position of dropdown</li>
<li>width of dropdown</li>
<li>fieldname data is transferred to Lua</li>
<li>items to be shown in dropdown</li>
<li>index of currently selected dropdown item</li>
<li>Width of dropdown</li>
<li>Fieldname data is transferred to Lua</li>
<li>Items to be shown in dropdown</li>
<li>Index of currently selected dropdown item</li>
</ul>
<h4 id="checkboxxynamelabelselectedtooltip"><code>checkbox[&lt;X&gt;,&lt;Y&gt;;&lt;name&gt;;&lt;label&gt;;&lt;selected&gt;;&lt;tooltip&gt;]</code></h4>
<h4 id="checkboxxynamelabelselected"><code>checkbox[&lt;X&gt;,&lt;Y&gt;;&lt;name&gt;;&lt;label&gt;;&lt;selected&gt;]</code></h4>
<ul>
<li>show a checkbox</li>
<li>Show a checkbox</li>
<li><a class="anchor" href="#x_14" name="x_14">#</a><code>x</code> and <code>y</code>: position of checkbox</li>
<li><a class="anchor" href="#name_7" name="name_7">#</a><code>name</code> fieldname data is transferred to Lua</li>
<li><a class="anchor" href="#label_5" name="label_5">#</a><code>label</code> to be shown left of checkbox</li>
<li><a class="anchor" href="#selected" name="selected">#</a><code>selected</code> (optional): <code>true</code>/<code>false</code></li>
<li><a class="anchor" href="#tooltip" name="tooltip">#</a><code>tooltip</code> (optional)</li>
</ul>
<h4 id="scrollbarxywhorientationnamevalue"><code>scrollbar[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;orientation&gt;;&lt;name&gt;;&lt;value&gt;]</code></h4>
<ul>
<li>show a scrollbar</li>
<li>there are two ways to use it:<ol>
<li>Show a scrollbar</li>
<li>There are two ways to use it:<ol>
<li>handle the changed event (only changed scrollbar is available)</li>
<li>read the value on pressing a button (all scrollbars are available)</li>
</ol>
@ -1810,24 +1815,24 @@ list[current_player;craftpreview;7,1;1,1;]
<li><a class="anchor" href="#x_15" name="x_15">#</a><code>x</code> and <code>y</code>: position of trackbar</li>
<li><a class="anchor" href="#w_7" name="w_7">#</a><code>w</code> and <code>h</code>: width and height</li>
<li><a class="anchor" href="#orientation" name="orientation">#</a><code>orientation</code>: <code>vertical</code>/<code>horizontal</code></li>
<li>fieldname data is transferred to Lua</li>
<li><a class="anchor" href="#0_4" name="0_4">#</a>value this trackbar is set to (<code>0</code>-<code>1000</code>)</li>
<li><a class="anchor" href="#minetestexplode_scrollbar_event" name="minetestexplode_scrollbar_event">#</a>see also <code>minetest.explode_scrollbar_event</code> (main menu: <code>engine.explode_scrollbar_event</code>)</li>
<li>Fieldname data is transferred to Lua</li>
<li><a class="anchor" href="#0_4" name="0_4">#</a>Value this trackbar is set to (<code>0</code>-<code>1000</code>)</li>
<li><a class="anchor" href="#minetestexplode_scrollbar_event" name="minetestexplode_scrollbar_event">#</a>See also <code>minetest.explode_scrollbar_event</code> (main menu: <code>engine.explode_scrollbar_event</code>)</li>
</ul>
<h4 id="tablexywhnamecell-1cell-2cell-nselected-idx"><code>table[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;cell 1&gt;,&lt;cell 2&gt;,...,&lt;cell n&gt;;&lt;selected idx&gt;]</code></h4>
<ul>
<li><a class="anchor" href="#tableoptions" name="tableoptions">#</a>show scrollable table using options defined by the previous <code>tableoptions[]</code></li>
<li><a class="anchor" href="#tablecolumns" name="tablecolumns">#</a>displays cells as defined by the previous <code>tablecolumns[]</code></li>
<li><a class="anchor" href="#tableoptions" name="tableoptions">#</a>Show scrollable table using options defined by the previous <code>tableoptions[]</code></li>
<li><a class="anchor" href="#tablecolumns" name="tablecolumns">#</a>Displays cells as defined by the previous <code>tablecolumns[]</code></li>
<li><a class="anchor" href="#x_16" name="x_16">#</a><code>x</code> and <code>y</code>: position the itemlist relative to the top left of the menu</li>
<li><a class="anchor" href="#w_8" name="w_8">#</a><code>w</code> and <code>h</code> are the size of the itemlist</li>
<li><a class="anchor" href="#name_8" name="name_8">#</a><code>name</code>: fieldname sent to server on row select or doubleclick</li>
<li><a class="anchor" href="#cell1" name="cell1">#</a><code>cell 1</code>...<code>cell n</code>: cell contents given in row-major order</li>
<li><a class="anchor" href="#selectedidx" name="selectedidx">#</a><code>selected idx</code>: index of row to be selected within table (first row = <code>1</code>)</li>
<li><a class="anchor" href="#minetestexplode_table_event" name="minetestexplode_table_event">#</a>see also <code>minetest.explode_table_event</code> (main menu: <code>engine.explode_table_event</code>)</li>
<li><a class="anchor" href="#minetestexplode_table_event" name="minetestexplode_table_event">#</a>See also <code>minetest.explode_table_event</code> (main menu: <code>engine.explode_table_event</code>)</li>
</ul>
<h4 id="tableoptionsopt-1opt-2"><code>tableoptions[&lt;opt 1&gt;;&lt;opt 2&gt;;...]</code></h4>
<ul>
<li><a class="anchor" href="#table" name="table">#</a>sets options for <code>table[]</code></li>
<li><a class="anchor" href="#table" name="table">#</a>Sets options for <code>table[]</code></li>
<li><a class="anchor" href="#colorRRGGBB" name="colorRRGGBB">#</a><code>color=#RRGGBB</code><ul>
<li><a class="anchor" href="#ColorString_4" name="ColorString_4">#</a>default text color (<code>ColorString</code>), defaults to <code>#FFFFFF</code></li>
</ul>
@ -1856,8 +1861,8 @@ list[current_player;craftpreview;7,1;1,1;]
</ul>
<h4 id="tablecolumnstype-1opt-1aopt-1btype-2opt-2aopt-2b"><code>tablecolumns[&lt;type 1&gt;,&lt;opt 1a&gt;,&lt;opt 1b&gt;,...;&lt;type 2&gt;,&lt;opt 2a&gt;,&lt;opt 2b&gt;;...]</code></h4>
<ul>
<li><a class="anchor" href="#table_1" name="table_1">#</a>sets columns for <code>table[]</code></li>
<li><a class="anchor" href="#text_6" name="text_6">#</a>types: <code>text</code>, <code>image</code>, <code>color</code>, <code>indent</code>, <code>tree</code><ul>
<li><a class="anchor" href="#table_1" name="table_1">#</a>Sets columns for <code>table[]</code></li>
<li><a class="anchor" href="#text_6" name="text_6">#</a>Types: <code>text</code>, <code>image</code>, <code>color</code>, <code>indent</code>, <code>tree</code><ul>
<li><a class="anchor" href="#text_7" name="text_7">#</a><code>text</code>: show cell contents as text</li>
<li><a class="anchor" href="#image_1" name="image_1">#</a><code>image</code>: cell contents are an image index, use column options to define images</li>
<li><a class="anchor" href="#color_1" name="color_1">#</a><code>color</code>: cell contents are a ColorString and define color of following cell</li>
@ -1865,7 +1870,7 @@ list[current_player;craftpreview;7,1;1,1;]
<li><a class="anchor" href="#tree" name="tree">#</a><code>tree</code>: same as indent, but user can open and close subtrees (treeview-like)</li>
</ul>
</li>
<li><a class="anchor" href="#alignvalue" name="alignvalue">#</a>column options:<ul>
<li><a class="anchor" href="#alignvalue" name="alignvalue">#</a>Column options:<ul>
<li><a class="anchor" href="#alignvalue_1" name="alignvalue_1">#</a><code>align=&lt;value&gt;</code><ul>
<li><a class="anchor" href="#text_8" name="text_8">#</a>for <code>text</code> and <code>image</code>: content alignment within cells.
Available values: <code>left</code> (default), <code>center</code>, <code>right</code>, <code>inline</code></li>
@ -1922,6 +1927,22 @@ numerical form, the raw integer value of an ARGB8 quad:
<code>colorspec = 0xFF00FF00</code>
or string form, a ColorString (defined above):
<code>colorspec = "green"</code></p>
<h2 id="escape-sequences">Escape sequences</h2>
<p>Most text can contain escape sequences, that can for example color the text.
There are a few exceptions: tab headers, dropdowns and vertical labels can't.
The following functions provide escape sequences:
<em> <code>core.get_color_escape_sequence(color)</code>:
* <code>color</code> is a ColorString
* The escape sequence sets the text color to <code>color</code>
</em> <code>core.colorize(color, message)</code>:
* Equivalent to:
<code>core.get_color_escape_sequence(color) ..
message ..
core.get_color_escape_sequence("#ffffff")</code>
* <code>color.get_background_escape_sequence(color)</code>
* <code>color</code> is a ColorString
* The escape sequence sets the background of the whole text element to
<code>color</code>. Only defined for item descriptions and tooltips.</p>
<h2 id="spatial-vectors">Spatial Vectors</h2>
<ul>
<li><a class="anchor" href="#vectornewabc" name="vectornewabc">#</a><code>vector.new(a[, b, c])</code>: returns a vector:<ul>
@ -2087,7 +2108,19 @@ or string form, a ColorString (defined above):
<li><a class="anchor" href="#minetestregister_toolnameitemdefinition_1" name="minetestregister_toolnameitemdefinition_1">#</a><code>minetest.register_tool(name, item definition)</code></li>
<li><a class="anchor" href="#minetestregister_craftitemnameitemdefinition_1" name="minetestregister_craftitemnameitemdefinition_1">#</a><code>minetest.register_craftitem(name, item definition)</code></li>
<li><a class="anchor" href="#minetestregister_aliasnameconvert_to" name="minetestregister_aliasnameconvert_to">#</a><code>minetest.register_alias(name, convert_to)</code></li>
<li><a class="anchor" href="#minetestregister_craftrecipe" name="minetestregister_craftrecipe">#</a><code>minetest.register_craft(recipe)</code></li>
<li><a class="anchor" href="#minetestregister_craftrecipe" name="minetestregister_craftrecipe">#</a><code>minetest.register_craft(recipe)</code><ul>
<li>Check recipe table syntax for different types below.</li>
</ul>
</li>
<li><a class="anchor" href="#minetestclear_craftrecipe" name="minetestclear_craftrecipe">#</a><code>minetest.clear_craft(recipe)</code><ul>
<li>Will erase existing craft based either on output item or on input recipe.</li>
<li><a class="anchor" href="#minetestregister_craftrecipe_1" name="minetestregister_craftrecipe_1">#</a>Specify either output or input only. If you specify both, input will be ignored. For input use the same recipe table
syntax as for <code>minetest.register_craft(recipe)</code>. For output specify only the item, without a quantity.</li>
<li>If no erase candidate could be found, Lua exception will be thrown.</li>
<li>Warning! The type field ("shaped","cooking" or any other) will be ignored if the recipe
contains output. Erasing is then done independently from the crafting method.</li>
</ul>
</li>
<li><a class="anchor" href="#minetestregister_oreoredefinition_1" name="minetestregister_oreoredefinition_1">#</a><code>minetest.register_ore(ore definition)</code></li>
<li><a class="anchor" href="#minetestregister_decorationdecorationdefinition_1" name="minetestregister_decorationdecorationdefinition_1">#</a><code>minetest.register_decoration(decoration definition)</code></li>
<li><a class="anchor" href="#minetestoverride_itemnameredefinition" name="minetestoverride_itemnameredefinition">#</a>
@ -2184,8 +2217,9 @@ or string form, a ColorString (defined above):
<li>Called when a player joins the game</li>
</ul>
</li>
<li><a class="anchor" href="#minetestregister_on_leaveplayerfuncObjectRef" name="minetestregister_on_leaveplayerfuncObjectRef">#</a><code>minetest.register_on_leaveplayer(func(ObjectRef))</code><ul>
<li><a class="anchor" href="#minetestregister_on_leaveplayerfuncObjectReftimed_out" name="minetestregister_on_leaveplayerfuncObjectReftimed_out">#</a><code>minetest.register_on_leaveplayer(func(ObjectRef, timed_out))</code><ul>
<li>Called when a player leaves the game</li>
<li><a class="anchor" href="#timed_out" name="timed_out">#</a><code>timed_out</code>: True for timeout, false for other reasons.</li>
</ul>
</li>
<li><a class="anchor" href="#minetestregister_on_cheatfuncObjectRefcheat" name="minetestregister_on_cheatfuncObjectRefcheat">#</a><code>minetest.register_on_cheat(func(ObjectRef, cheat))</code><ul>
@ -2244,7 +2278,8 @@ or string form, a ColorString (defined above):
<li><a class="anchor" href="#minetestregister_chatcommandcmdchatcommanddefinition" name="minetestregister_chatcommandcmdchatcommanddefinition">#</a><code>minetest.register_chatcommand(cmd, chatcommand definition)</code></li>
<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><a class="anchor" href="#definition_1" name="definition_1">#</a><code>definition</code>: <code>{ description = "description text", give_to_singleplayer = boolean}</code>
the default of <code>give_to_singleplayer</code> is true </li>
<li>To allow players with basic_privs to grant, see basic_privs minetest.conf setting.</li>
</ul>
</li>
@ -2277,12 +2312,23 @@ or string form, a ColorString (defined above):
<li><a class="anchor" href="#namenil" name="namenil">#</a>To report everybody, set <code>name=nil</code>.</li>
</ul>
</li>
<li><a class="anchor" href="#minetestcheck_password_entrynameentrypassword" name="minetestcheck_password_entrynameentrypassword">#</a><code>minetest.check_password_entry(name, entry, password)</code><ul>
<li>Returns true if the "db entry" for a player with name matches given</li>
<li>password, false otherwise.</li>
<li>The "db entry" is the usually player-individual value that is derived</li>
<li>from the player's chosen password and stored on the server in order to allow</li>
<li>authentication whenever the player desires to log in.</li>
<li>Only use this function for making it possible to log in via the password from</li>
<li>via protocols like IRC, other uses for inside the game are frowned upon.</li>
</ul>
</li>
<li><a class="anchor" href="#minetestget_password_hashnameraw_password" name="minetestget_password_hashnameraw_password">#</a><code>minetest.get_password_hash(name, raw_password)</code><ul>
<li>Convert a name-password pair to a password hash that Minetest can use.</li>
<li>The returned value alone is not a good basis for password checks based</li>
<li>on comparing the password hash in the database with the password hash</li>
<li>from the function, with an externally provided password, as the hash</li>
<li>in the db might use the new SRP verifier format.</li>
<li>For this purpose, use minetest.check_password_entry instead.</li>
</ul>
</li>
<li><a class="anchor" href="#mineteststring_to_privsstr" name="mineteststring_to_privsstr">#</a><code>minetest.string_to_privs(str)</code>: returns <code>{priv1=true,...}</code></li>
@ -2444,7 +2490,9 @@ and <code>minetest.auth_reload</code> call the authetification handler.</p>
</li>
<li><a class="anchor" href="#minetestget_mapgen_params" name="minetestget_mapgen_params">#</a><code>minetest.get_mapgen_params()</code> Returns mapgen parameters, a table containing
<code>mgname</code>, <code>seed</code>, <code>chunksize</code>, <code>water_level</code>, and <code>flags</code>.</li>
<li>Deprecated: use minetest.get_mapgen_setting(name) instead</li>
<li><a class="anchor" href="#minetestset_mapgen_paramsMapgenParams" name="minetestset_mapgen_paramsMapgenParams">#</a><code>minetest.set_mapgen_params(MapgenParams)</code><ul>
<li>Deprecated: use minetest.set_mapgen_setting(name, value, override) instead</li>
<li>Set map generation parameters</li>
<li><a class="anchor" href="#on_mapgen_init" name="on_mapgen_init">#</a>Function cannot be called after the registration period; only initialization
and <code>on_mapgen_init</code></li>
@ -2458,8 +2506,29 @@ and <code>minetest.auth_reload</code> call the authetification handler.</p>
</li>
</ul>
</li>
<li><a class="anchor" href="#minetestget_mapgen_settingname" name="minetestget_mapgen_settingname">#</a><code>minetest.get_mapgen_setting(name)</code><ul>
<li>Gets the <em>active</em> mapgen setting (or nil if none exists) in string format with the following
order of precedence:
1) Settings loaded from map_meta.txt or overrides set during mod execution
2) Settings set by mods without a metafile override
3) Settings explicitly set in the user config file, minetest.conf
4) Settings set as the user config default</li>
</ul>
</li>
<li><a class="anchor" href="#minetestget_mapgen_setting_noiseparamsname" name="minetestget_mapgen_setting_noiseparamsname">#</a><code>minetest.get_mapgen_setting_noiseparams(name)</code><ul>
<li><a class="anchor" href="#name_9" name="name_9">#</a>Same as above, but returns the value as a NoiseParams table if the setting <code>name</code> exists
and is a valid NoiseParams</li>
</ul>
</li>
<li><a class="anchor" href="#minetestset_mapgen_settingnamevalueoverride_metafalse" name="minetestset_mapgen_settingnamevalueoverride_metafalse">#</a><code>minetest.set_mapgen_setting(name, value, [override_meta=false])</code></li>
<li><a class="anchor" href="#value" name="value">#</a>Sets a mapgen param to <code>value</code>, and will take effect if the corresponding mapgen setting
is not already present in map_meta.txt. If the optional boolean override_meta is set to true,
this setting will become the active setting regardless of the map metafile contents.</li>
<li>Note: to set the seed, use "seed", not "fixed_map_seed"</li>
<li><a class="anchor" href="#minetestset_mapgen_setting_noiseparamsnamevalueoverride_metafalse" name="minetestset_mapgen_setting_noiseparamsnamevalueoverride_metafalse">#</a><code>minetest.set_mapgen_setting_noiseparams(name, value, [override_meta=false])</code></li>
<li>Same as above, except value is a NoiseParams table</li>
<li><a class="anchor" href="#minetestset_noiseparamsnamenoiseparamsset_default" name="minetestset_noiseparamsnamenoiseparamsset_default">#</a><code>minetest.set_noiseparams(name, noiseparams, set_default)</code><ul>
<li><a class="anchor" href="#name_9" name="name_9">#</a>Sets the noiseparams setting of <code>name</code> to the noiseparams table specified in <code>noiseparams</code>.</li>
<li><a class="anchor" href="#name_10" name="name_10">#</a>Sets the noiseparams setting of <code>name</code> to the noiseparams table specified in <code>noiseparams</code>.</li>
<li><a class="anchor" href="#set_default" name="set_default">#</a><code>set_default</code> is an optional boolean (default: <code>true</code>) that specifies whether the setting
should be applied to the default config or current active config</li>
</ul>
@ -2925,7 +2994,7 @@ and <code>minetest.auth_reload</code> call the authetification handler.</p>
</ul>
</li>
<li><a class="anchor" href="#HTTPApiTablefetch_asyncHTTPRequestreq" name="HTTPApiTablefetch_asyncHTTPRequestreq">#</a><code>HTTPApiTable.fetch_async(HTTPRequest req)</code>: returns handle<ul>
<li><a class="anchor" href="#minetesthttp_fetch_async_get" name="minetesthttp_fetch_async_get">#</a>Performs given request asynchronously and returns handle for <code>minetest.http_fetch_async_get</code></li>
<li><a class="anchor" href="#HTTPApiTablefetch_async_get" name="HTTPApiTablefetch_async_get">#</a>Performs given request asynchronously and returns handle for <code>HTTPApiTable.fetch_async_get</code></li>
</ul>
</li>
<li><a class="anchor" href="#HTTPApiTablefetch_async_gethandle" name="HTTPApiTablefetch_async_gethandle">#</a><code>HTTPApiTable.fetch_async_get(handle)</code>: returns HTTPRequestResult<ul>
@ -2959,7 +3028,7 @@ and <code>minetest.auth_reload</code> call the authetification handler.</p>
</ul>
</li>
<li><a class="anchor" href="#minetestget_content_idname" name="minetestget_content_idname">#</a><code>minetest.get_content_id(name)</code>: returns an integer<ul>
<li><a class="anchor" href="#name_10" name="name_10">#</a>Gets the internal content ID of <code>name</code></li>
<li><a class="anchor" href="#name_11" name="name_11">#</a>Gets the internal content ID of <code>name</code></li>
</ul>
</li>
<li><a class="anchor" href="#minetestget_name_from_content_idcontent_id" name="minetestget_name_from_content_idcontent_id">#</a><code>minetest.get_name_from_content_id(content_id)</code>: returns a string<ul>
@ -3020,10 +3089,18 @@ and <code>minetest.auth_reload</code> call the authetification handler.</p>
<li><code>...</code> indicates method-specific arguments. Currently, no methods use this.</li>
</ul>
</li>
<li><a class="anchor" href="#minetestencode_base64string" name="minetestencode_base64string">#</a><code>minetest.encode_base64(string)</code>: returns string encoded in base64<ul>
<li>Encodes a string in base64.</li>
</ul>
</li>
<li><a class="anchor" href="#minetestdecode_base64string" name="minetestdecode_base64string">#</a><code>minetest.decode_base64(string)</code>: returns string<ul>
<li>Decodes a string encoded in base64.</li>
</ul>
</li>
<li><a class="anchor" href="#minetestis_protectedposname" name="minetestis_protectedposname">#</a>
<p><code>minetest.is_protected(pos, name)</code>: returns boolean</p>
<ul>
<li><a class="anchor" href="#name_11" name="name_11">#</a>Returns true, if player <code>name</code> shouldn't be abled to dig at <code>pos</code> or do other
<li><a class="anchor" href="#name_12" name="name_12">#</a>Returns true, if player <code>name</code> shouldn't be abled to dig at <code>pos</code> or do other
actions, defineable by mods, due to some mod-defined ownership-like concept.
Returns false or nil, if the player is allowed to do such actions.</li>
<li>This function should be overridden by protection mods and should be used to
@ -3295,12 +3372,35 @@ Can be gotten via <code>minetest.get_node_timer(pos)</code>.</p>
<h5 id="player-only-no-op-for-other-objects">Player-only (no-op for other objects)</h5>
<ul>
<li><a class="anchor" href="#get_player_name" name="get_player_name">#</a><code>get_player_name()</code>: returns <code>""</code> if is not a player</li>
<li><a class="anchor" href="#get_player_velocity" name="get_player_velocity">#</a><code>get_player_velocity()</code>: returns <code>nil</code> if is not a player otherwise a table {x, y, z} representing the player's instantaneous velocity in nodes/s</li>
<li><a class="anchor" href="#get_player_velocity" name="get_player_velocity">#</a><code>get_player_velocity()</code>: returns <code>nil</code> if is not a player, otherwise a
table {x, y, z} representing the player's instantaneous velocity in nodes/s</li>
<li><a class="anchor" href="#get_look_dir" name="get_look_dir">#</a><code>get_look_dir()</code>: get camera direction as a unit vector</li>
<li><a class="anchor" href="#get_look_pitch" name="get_look_pitch">#</a><code>get_look_pitch()</code>: pitch in radians</li>
<li><a class="anchor" href="#get_look_yaw" name="get_look_yaw">#</a><code>get_look_yaw()</code>: yaw in radians (wraps around pretty randomly as of now)</li>
<li><a class="anchor" href="#set_look_pitchradians" name="set_look_pitchradians">#</a><code>set_look_pitch(radians)</code>: sets look pitch</li>
<li><a class="anchor" href="#set_look_yawradians" name="set_look_yawradians">#</a><code>set_look_yaw(radians)</code>: sets look yaw</li>
<li><a class="anchor" href="#get_look_vertical" name="get_look_vertical">#</a><code>get_look_vertical()</code>: pitch in radians<ul>
<li>Angle ranges between -pi/2 and pi/2, which are straight up and down respectively.</li>
</ul>
</li>
<li><a class="anchor" href="#get_look_horizontal" name="get_look_horizontal">#</a><code>get_look_horizontal()</code>: yaw in radians<ul>
<li>Angle is counter-clockwise from the +z direction.</li>
</ul>
</li>
<li><a class="anchor" href="#set_look_verticalradians" name="set_look_verticalradians">#</a><code>set_look_vertical(radians)</code>: sets look pitch<ul>
<li>radians - Angle from looking forward, where positive is downwards.</li>
</ul>
</li>
<li><a class="anchor" href="#set_look_horizontalradians" name="set_look_horizontalradians">#</a><code>set_look_horizontal(radians)</code>: sets look yaw<ul>
<li>radians - Angle from the +z direction, where positive is counter-clockwise.</li>
</ul>
</li>
<li><a class="anchor" href="#get_look_pitch" name="get_look_pitch">#</a><code>get_look_pitch()</code>: pitch in radians - Deprecated as broken. Use get_look_vertical.<ul>
<li>Angle ranges between -pi/2 and pi/2, which are straight down and up respectively.</li>
</ul>
</li>
<li><a class="anchor" href="#get_look_yaw" name="get_look_yaw">#</a><code>get_look_yaw()</code>: yaw in radians - Deprecated as broken. Use get_look_horizontal.<ul>
<li>Angle is counter-clockwise from the +x direction.</li>
</ul>
</li>
<li><a class="anchor" href="#set_look_pitchradians" name="set_look_pitchradians">#</a><code>set_look_pitch(radians)</code>: sets look pitch - Deprecated. Use set_look_vertical.</li>
<li><a class="anchor" href="#set_look_yawradians" name="set_look_yawradians">#</a><code>set_look_yaw(radians)</code>: sets look yaw - Deprecated. Use set_look_horizontal.</li>
<li><a class="anchor" href="#get_breath" name="get_breath">#</a><code>get_breath()</code>: returns players breath</li>
<li><a class="anchor" href="#set_breathvalue" name="set_breathvalue">#</a><code>set_breath(value)</code>: sets players breath<ul>
<li><a class="anchor" href="#0_9" name="0_9">#</a>values:<ul>
@ -3374,7 +3474,7 @@ Can be gotten via <code>minetest.get_node_timer(pos)</code>.</p>
<li><a class="anchor" href="#hud_get_hotbar_selected_image" name="hud_get_hotbar_selected_image">#</a><code>hud_get_hotbar_selected_image</code>: returns texturename</li>
<li><a class="anchor" href="#hud_replace_builtinnamehud_definition" name="hud_replace_builtinnamehud_definition">#</a><code>hud_replace_builtin(name, hud_definition)</code><ul>
<li>replace definition of a builtin hud element</li>
<li><a class="anchor" href="#name_12" name="name_12">#</a><code>name</code>: <code>"breath"</code> or <code>"health"</code></li>
<li><a class="anchor" href="#name_13" name="name_13">#</a><code>name</code>: <code>"breath"</code> or <code>"health"</code></li>
<li><a class="anchor" href="#hud_definition" name="hud_definition">#</a><code>hud_definition</code>: definition to replace builtin definition</li>
</ul>
</li>
@ -3450,27 +3550,42 @@ Can be gotten via <code>minetest.get_node_timer(pos)</code>.</p>
<p>A fast access data structure to store areas, and find areas near a given position or area.
Every area has a <code>data</code> string attribute to store additional information.
You can create an empty <code>AreaStore</code> by calling <code>AreaStore()</code>, or <code>AreaStore(type_name)</code>.
If you chose the parameter-less constructor, a fast implementation will be automatically chosen for you.</p>
If you chose the parameter-less constructor, a fast implementation will be automatically
chosen for you.</p>
<h4 id="methods_4">Methods</h4>
<ul>
<li><a class="anchor" href="#get_areaidinclude_bordersinclude_data" name="get_areaidinclude_bordersinclude_data">#</a><code>get_area(id, include_borders, include_data)</code>: returns the area with the id <code>id</code>. (optional) Boolean values <code>include_borders</code> and <code>include_data</code> control what's copied.</li>
<li><a class="anchor" href="#get_areas_for_posposinclude_bordersinclude_data" name="get_areas_for_posposinclude_bordersinclude_data">#</a><code>get_areas_for_pos(pos, include_borders, include_data)</code>: returns all areas that contain the position <code>pos</code>. (optional) Boolean values <code>include_borders</code> and <code>include_data</code> control what's copied.</li>
<li><a class="anchor" href="#get_areas_in_areaedge1edge2accept_overlapinclude_bordersinclude_data" name="get_areas_in_areaedge1edge2accept_overlapinclude_bordersinclude_data">#</a><code>get_areas_in_area(edge1, edge2, accept_overlap, include_borders, include_data)</code>: returns all areas that contain all nodes inside the area specified by <code>edge1</code> and <code>edge2</code> (inclusive). If <code>accept_overlap</code> is true, also areas are returned that have nodes in common with the specified area. (optional) Boolean values <code>include_borders</code> and <code>include_data</code> control what's copied.</li>
<li><a class="anchor" href="#insert_areaedge1edge2dataid" name="insert_areaedge1edge2dataid">#</a><code>insert_area(edge1, edge2, data, [id])</code>: inserts an area into the store. Returns the new area's ID, or nil if the insertion failed. The (inclusive) positions <code>edge1</code> and <code>edge2</code> describe the area. <code>data</code> is a string stored with the area. If passed, <code>id</code> will be used as the internal area ID, it must be a unique number between 0 and 2^32-2. If you use the <code>id</code> parameter you must always use it, or insertions are likely to fail due to conflicts.</li>
<li><a class="anchor" href="#reservecount" name="reservecount">#</a><code>reserve(count)</code>: reserves resources for at most <code>count</code> many contained areas. Only needed for efficiency, and only some implementations profit.</li>
<li><a class="anchor" href="#get_areaidinclude_bordersinclude_data" name="get_areaidinclude_bordersinclude_data">#</a><code>get_area(id, include_borders, include_data)</code>: returns the area with the id <code>id</code>.
(optional) Boolean values <code>include_borders</code> and <code>include_data</code> control what's copied.</li>
<li><a class="anchor" href="#get_areas_for_posposinclude_bordersinclude_data" name="get_areas_for_posposinclude_bordersinclude_data">#</a><code>get_areas_for_pos(pos, include_borders, include_data)</code>: returns all areas that contain
the position <code>pos</code>. (optional) Boolean values <code>include_borders</code> and <code>include_data</code> control
what's copied.</li>
<li><a class="anchor" href="#get_areas_in_areaedge1edge2accept_overlapinclude_bordersinclude_data" name="get_areas_in_areaedge1edge2accept_overlapinclude_bordersinclude_data">#</a><code>get_areas_in_area(edge1, edge2, accept_overlap, include_borders, include_data)</code>:
returns all areas that contain all nodes inside the area specified by <code>edge1</code> and <code>edge2</code> (inclusive).
If <code>accept_overlap</code> is true, also areas are returned that have nodes in common with the specified area.
(optional) Boolean values <code>include_borders</code> and <code>include_data</code> control what's copied.</li>
<li><a class="anchor" href="#insert_areaedge1edge2dataid" name="insert_areaedge1edge2dataid">#</a><code>insert_area(edge1, edge2, data, [id])</code>: inserts an area into the store. Returns the new area's ID,
or nil if the insertion failed. The (inclusive) positions <code>edge1</code> and <code>edge2</code> describe the area.
<code>data</code> is a string stored with the area. If passed, <code>id</code> will be used as the internal area ID,
it must be a unique number between 0 and 2^32-2. If you use the <code>id</code> parameter you must always use it,
or insertions are likely to fail due to conflicts.</li>
<li><a class="anchor" href="#reservecount" name="reservecount">#</a><code>reserve(count)</code>: reserves resources for at most <code>count</code> many contained areas.
Only needed for efficiency, and only some implementations profit.</li>
<li><a class="anchor" href="#remove_areaid" name="remove_areaid">#</a><code>remove_area(id)</code>: removes the area with the given id from the store, returns success.</li>
<li><a class="anchor" href="#set_cache_paramsparams" name="set_cache_paramsparams">#</a><code>set_cache_params(params)</code>: sets params for the included prefiltering cache. Calling invalidates the cache, so that its elements have to be newly generated.<ul>
<li><a class="anchor" href="#set_cache_paramsparams" name="set_cache_paramsparams">#</a><code>set_cache_params(params)</code>: sets params for the included prefiltering cache.
Calling invalidates the cache, so that its elements have to be newly generated.<ul>
<li><a class="anchor" href="#params" name="params">#</a><code>params</code>:
{
enabled = boolean, -- whether to enable, default true
block_radius = number, -- the radius (in nodes) of the areas the cache generates prefiltered lists for, minimum 16, default 64
block_radius = number, -- the radius (in nodes) of the areas the cache generates
prefiltered lists for, minimum 16, default 64
limit = number, -- the cache's size, minimum 20, default 1000
}</li>
</ul>
</li>
<li><a class="anchor" href="#to_string" name="to_string">#</a><code>to_string()</code>: Experimental. Returns area store serialized as a (binary) string.</li>
<li><a class="anchor" href="#to_filefilename" name="to_filefilename">#</a><code>to_file(filename)</code>: Experimental. Like <code>to_string()</code>, but writes the data to a file.</li>
<li><a class="anchor" href="#from_stringstr" name="from_stringstr">#</a><code>from_string(str)</code>: Experimental. Deserializes string and loads it into the AreaStore. Returns success and, optionally, an error message.</li>
<li><a class="anchor" href="#from_stringstr" name="from_stringstr">#</a><code>from_string(str)</code>: Experimental. Deserializes string and loads it into the AreaStore.
Returns success and, optionally, an error message.</li>
<li><a class="anchor" href="#from_filefilename" name="from_filefilename">#</a><code>from_file(filename)</code>: Experimental. Like <code>from_string()</code>, but reads the data from a file.</li>
</ul>
<h3 id="itemstack_1"><code>ItemStack</code></h3>
@ -3535,7 +3650,9 @@ Uses PCG32, an algorithm of the permuted congruential generator family, offering
<li><a class="anchor" href="#next_1" name="next_1">#</a><code>next()</code>: return next integer random number [<code>-2147483648</code>...<code>2147483647</code>]</li>
<li><a class="anchor" href="#nextminmax_1" name="nextminmax_1">#</a><code>next(min, max)</code>: return next integer random number [<code>min</code>...<code>max</code>]</li>
<li><a class="anchor" href="#rand_normal_distminmaxnum_trials6" name="rand_normal_distminmaxnum_trials6">#</a><code>rand_normal_dist(min, max, num_trials=6)</code>: return normally distributed random number [<code>min</code>...<code>max</code>]<ul>
<li>This is only a rough approximation of a normal distribution with mean=(max-min)/2 and variance=1</li>
<li>This is only a rough approximation of a normal distribution with:</li>
<li>mean = (max - min) / 2, and</li>
<li>variance = (((max - min + 1) ^ 2) - 1) / (12 * num_trials)</li>
<li>Increasing num_trials improves accuracy of the approximation</li>
</ul>
</li>
@ -3859,7 +3976,7 @@ numeric unique decoration ID.</p>
<h2 id="registered-entities">Registered entities</h2>
<ul>
<li><a class="anchor" href="#self" name="self">#</a>Functions receive a "luaentity" as <code>self</code>:<ul>
<li><a class="anchor" href="#name_13" name="name_13">#</a>It has the member <code>.name</code>, which is the registered name <code>("mod:thing")</code></li>
<li><a class="anchor" href="#name_14" name="name_14">#</a>It has the member <code>.name</code>, which is the registered name <code>("mod:thing")</code></li>
<li><a class="anchor" href="#object" name="object">#</a>It has the member <code>.object</code>, which is an <code>ObjectRef</code> pointing to the object</li>
<li>The original prototype stuff is visible directly via a metatable</li>
</ul>
@ -4013,6 +4130,9 @@ minetest.spawn_tree(pos,apple_tree)
</code></pre>
<h3 id="abm-activeblockmodifier-definition-register_abm">ABM (ActiveBlockModifier) definition (<code>register_abm</code>)</h3>
<pre><code>{
label = "Lava cooling",
-- ^ Descriptive label for profiling purposes (optional).
-- Definitions with identical labels will be listed as one.
-- In the following two fields, also group:groupname will work.
nodenames = {"default:lava_source"},
neighbors = {"default:water_source", "default:water_flowing"}, -- Any of these --[[
@ -4028,6 +4148,9 @@ minetest.spawn_tree(pos,apple_tree)
</code></pre>
<h3 id="lbm-loadingblockmodifier-definition-register_lbm">LBM (LoadingBlockModifier) definition (<code>register_lbm</code>)</h3>
<pre><code>{
label = "Upgrade legacy doors",
-- ^ Descriptive label for profiling purposes (optional).
-- Definitions with identical labels will be listed as one.
name = "modname:replace_legacy_door",
nodenames = {"default:lava_source"},
-- ^ List of node names to trigger the LBM on.
@ -4158,6 +4281,7 @@ minetest.spawn_tree(pos,apple_tree)
^ paramtype = "light" allows light to propagate from or through the node with light value
^ falling by 1 per node. This line is essential for a light source node to spread its light. ]]
paramtype2 = "none", -- See "Nodes"
place_param2 = nil, -- Force value for param2 when player places node
is_ground_content = true, -- If false, the cave generator will not carve through this
sunlight_propagates = false, -- If true, sunlight will go infinitely through this
walkable = true, -- If true, objects collide with node
@ -4170,7 +4294,8 @@ minetest.spawn_tree(pos,apple_tree)
liquid_alternative_flowing = "", -- Flowing version of source liquid
liquid_alternative_source = "", -- Source version of flowing liquid
liquid_viscosity = 0, -- Higher viscosity = slower flow (max. 7)
liquid_renewable = true, -- Can new liquid source be created by placing two or more sources nearby?
liquid_renewable = true, --[[
^ If true, a new liquid source can be created by placing two or more sources nearby ]]
leveled = 0, --[[
^ Block contains level in param2. Value is default level, used for snow.
^ Don't forget to use "leveled" type nodebox. ]]
@ -4203,8 +4328,8 @@ minetest.spawn_tree(pos,apple_tree)
max_items = 1, -- Maximum number of items to drop.
items = { -- Choose max_items randomly from this list.
{
items = {"foo:bar", "baz:frob"}, -- Choose one item randomly from this list.
rarity = 1, -- Probability of getting is 1 / rarity.
items = {"foo:bar", "baz:frob"}, -- Items to drop.
rarity = 1, -- Probability of dropping is 1 / rarity.
},
},
},
@ -4369,6 +4494,8 @@ minetest.spawn_tree(pos,apple_tree)
}
</code></pre>
<h3 id="biome-definition-register_biome">Biome definition (<code>register_biome</code>)</h3>
<p><strong>Note</strong>
The Biome API is still in an experimental phase and subject to change.</p>
<pre><code>{
name = "tundra",
node_dust = "default:snow",
@ -4388,6 +4515,9 @@ minetest.spawn_tree(pos,apple_tree)
-- ^ Node that replaces all seawater nodes not in the defined surface layer.
node_river_water = "default:ice",
-- ^ Node that replaces river water in mapgens that use default:river_water.
node_riverbed = "default:gravel",
depth_riverbed = 2,
-- ^ Node placed under river water and thickness of this layer.
y_min = 1,
y_max = 31000,
-- ^ Lower and upper limits for biome.
@ -4555,6 +4685,9 @@ minetest.spawn_tree(pos,apple_tree)
size = 1,
collisiondetection = false,
-- ^ collisiondetection: if true collides with physical objects
collision_removal = false,
-- ^ collision_removal: if true then particle is removed when it collides,
-- ^ requires collisiondetection = true to have any effect
vertical = false,
-- ^ vertical: if true faces player using y axis only
texture = "image.png",
@ -4583,6 +4716,9 @@ minetest.spawn_tree(pos,apple_tree)
-- ^ minsize/maxsize, minexptime/maxexptime (expirationtime)
collisiondetection = false,
-- ^ collisiondetection: if true uses collision detection
collision_removal = false,
-- ^ collision_removal: if true then particle is removed when it collides,
-- ^ requires collisiondetection = true to have any effect
vertical = false,
-- ^ vertical: if true faces player using y axis only
texture = "image.png",
@ -4591,7 +4727,7 @@ minetest.spawn_tree(pos,apple_tree)
-- ^ Playername is optional, if specified spawns particle only on the player's client
}
</code></pre>
<h3 id="httprequest-definition-http_fetch-http_fetch_async"><code>HTTPRequest</code> definition (<code>http_fetch</code>, <code>http_fetch_async</code>)</h3>
<h3 id="httprequest-definition-httpapitablefetch_async-httpapitablefetch_async"><code>HTTPRequest</code> definition (<code>HTTPApiTable.fetch_async</code>, <code>HTTPApiTable.fetch_async</code>)</h3>
<pre><code>{
url = "http://example.org",
timeout = 10,
@ -4610,7 +4746,7 @@ minetest.spawn_tree(pos,apple_tree)
-- ^ Optional, if true performs a multipart HTTP request. Default is false.
}
</code></pre>
<h3 id="httprequestresult-definition-http_fetch-callback-http_fetch_async_get"><code>HTTPRequestResult</code> definition (<code>http_fetch</code> callback, <code>http_fetch_async_get</code>)</h3>
<h3 id="httprequestresult-definition-httpapitablefetch-callback-httpapitablefetch_async_get"><code>HTTPRequestResult</code> definition (<code>HTTPApiTable.fetch</code> callback, <code>HTTPApiTable.fetch_async_get</code>)</h3>
<pre><code>{
completed = true,
-- ^ If true, the request has finished (either succeeded, failed or timed out)