<h2>This is lua_api.txt nicely formated: I did not write this</h2>
<h2>This is lua_api.txt nicely formated: I did not write this</h2>
This page was last updated 28/November/2017.<br/>See <ahref="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 <ahref="https://github.com/rubenwardy/minetest_modding_book/blob/gh-pages/update_lua_api.py">a Python script</a>.</div>
This page was last updated 13/January/2018.<br/>See <ahref="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 <ahref="https://github.com/rubenwardy/minetest_modding_book/blob/gh-pages/update_lua_api.py">a Python script</a>.</div>
<h2id="table-of-contents">Table of Contents</h2>
<h2id="table-of-contents">Table of Contents</h2>
<divclass="toc">
<divclass="toc">
<ul>
<ul>
@ -411,24 +411,25 @@ This page was last updated 28/November/2017.<br />See <a href="https://github.co
</ul>This page was last updated 28/November/2017.<br/>See <ahref="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 <ahref="https://github.com/rubenwardy/minetest_modding_book/blob/gh-pages/update_lua_api.py">a Python script</a>.<h2id="programming-in-lua">Programming in Lua</h2>
</ul>This page was last updated 13/January/2018.<br/>See <ahref="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 <ahref="https://github.com/rubenwardy/minetest_modding_book/blob/gh-pages/update_lua_api.py">a Python script</a>.<h2id="programming-in-lua">Programming in Lua</h2>
<p>If you have any difficulty in understanding this, please read
<p>If you have any difficulty in understanding this, please read
<ahref="http://www.lua.org/pil/">Programming in Lua</a>.</p>
<ahref="http://www.lua.org/pil/">Programming in Lua</a>.</p>
<h2id="startup">Startup</h2>
<h2id="startup">Startup</h2>
@ -470,12 +471,19 @@ the <code>init.lua</code> scripts in a shared environment.</p>
<li><aclass="anchor"href="#a"name="a">#</a>A copy of <code>a</code> if <code>a</code> is a vector.</li>
<li><aclass="anchor"href="#a"name="a">#</a>A copy of <code>a</code> if <code>a</code> is a vector.</li>
<li><aclass="anchor"href="#xaybzc"name="xaybzc">#</a><code>{x = a, y = b, z = c}</code>, if all <code>a, b, c</code> are defined</li>
<li><aclass="anchor"href="#xaybzc"name="xaybzc">#</a><code>{x = a, y = b, z = c}</code>, if all of <code>a</code>, <code>b</code>, <code>c</code> are defined numbers.</li>
<li><aclass="anchor"href="#p1"name="p1">#</a>Returns a vector of length 1 with direction <code>p1</code> to <code>p2</code>.</li>
<li><aclass="anchor"href="#p1_1"name="p1_1">#</a>If <code>p1</code> and <code>p2</code> are identical, returns <code>{x = 0, y = 0, z = 0}</code>.</li>
<li><aclass="anchor"href="#v1"name="v1">#</a>Returns in order minp, maxp vectors of the cuboid defined by <code>v1</code>, <code>v2</code>.</li>
</ul>
</ul>
</li>
</li>
<li><aclass="anchor"href="#vectordirectionp1p2"name="vectordirectionp1p2">#</a><code>vector.direction(p1, p2)</code>: returns a vector</li>
<li><aclass="anchor"href="#vectordistancep1p2"name="vectordistancep1p2">#</a><code>vector.distance(p1, p2)</code>: returns a number</li>
<li><aclass="anchor"href="#vectorlengthv"name="vectorlengthv">#</a><code>vector.length(v)</code>: returns a number</li>
<li><aclass="anchor"href="#vectornormalizev"name="vectornormalizev">#</a><code>vector.normalize(v)</code>: returns a vector</li>
<li><aclass="anchor"href="#vectorfloorv"name="vectorfloorv">#</a><code>vector.floor(v)</code>: returns a vector, each dimension rounded down</li>
<li><aclass="anchor"href="#vectorroundv"name="vectorroundv">#</a><code>vector.round(v)</code>: returns a vector, each dimension rounded to nearest int</li>
<li><aclass="anchor"href="#vectorapplyvfunc"name="vectorapplyvfunc">#</a><code>vector.apply(v, func)</code>: returns a vector</li>
<li><aclass="anchor"href="#vectorequalsv1v2"name="vectorequalsv1v2">#</a><code>vector.equals(v1, v2)</code>: returns a boolean</li>
<li><aclass="anchor"href="#vectorsortv1v2"name="vectorsortv1v2">#</a><code>vector.sort(v1, v2)</code>: returns minp, maxp vectors of the cuboid defined by v1 and v2</li>
</ul>
</ul>
<p>For the following functions <code>x</code> can be either a vector or a number:</p>
<p>For the following functions <code>x</code> can be either a vector or a number:</p>
<ul>
<ul>
<li><aclass="anchor"href="#vectoraddvx"name="vectoraddvx">#</a><code>vector.add(v, x)</code>: returns a vector</li>
<li><aclass="anchor"href="#vectorsubtractvx"name="vectorsubtractvx">#</a><code>vector.subtract(v, x)</code>: returns a vector</li>
<li>Returns a vector.</li>
<li><aclass="anchor"href="#vectormultiplyvx"name="vectormultiplyvx">#</a><code>vector.multiply(v, x)</code>: returns a scaled vector or Schur product</li>
</ul>
<li><aclass="anchor"href="#vectordividevx"name="vectordividevx">#</a><code>vector.divide(v, x)</code>: returns a scaled vector or Schur quotient</li>
<li><aclass="anchor"href="#true_4" name="true_4">#</a>If return <code>true</code> no item is taken from <code>itemstack</code></li>
<li><aclass="anchor"href="#true_5" name="true_5">#</a>If return <code>true</code> no item is taken from <code>itemstack</code></li>
<li><aclass="anchor"href="#placer"name="placer">#</a><code>placer</code> may be any valid ObjectRef or nil.</li>
<li><aclass="anchor"href="#placer"name="placer">#</a><code>placer</code> may be any valid ObjectRef or nil.</li>
<li><aclass="anchor"href="#on_construct"name="on_construct">#</a><strong>Not recommended</strong>; use <code>on_construct</code> or <code>after_place_node</code> in node definition
<li><aclass="anchor"href="#on_construct"name="on_construct">#</a><strong>Not recommended</strong>; use <code>on_construct</code> or <code>after_place_node</code> in node definition
whenever possible</li>
whenever possible</li>
@ -2860,7 +2921,7 @@ The file should be a text file, with the following format:</p>
<li><aclass="anchor"href="#dir"name="dir">#</a><code>dir</code>: unit vector of direction of punch. Always defined. Points from
<li><aclass="anchor"href="#dir"name="dir">#</a><code>dir</code>: unit vector of direction of punch. Always defined. Points from
the puncher to the punched.</li>
the puncher to the punched.</li>
<li><aclass="anchor"href="#damage_1"name="damage_1">#</a><code>damage</code> - number that represents the damage calculated by the engine</li>
<li><aclass="anchor"href="#damage_1"name="damage_1">#</a><code>damage</code> - number that represents the damage calculated by the engine</li>
<li><aclass="anchor"href="#true_5" name="true_5">#</a>should return <code>true</code> to prevent the default damage mechanism</li>
<li><aclass="anchor"href="#true_6" name="true_6">#</a>should return <code>true</code> to prevent the default damage mechanism</li>
<li>Called always when a player says something</li>
<li>Called always when a player says something</li>
<li><aclass="anchor"href="#true_6" name="true_6">#</a>Return <code>true</code> to mark the message as handled, which means that it will not be sent to other players</li>
<li><aclass="anchor"href="#true_7" name="true_7">#</a>Return <code>true</code> to mark the message as handled, which means that it will not be sent to other players</li>
<li><aclass="anchor"href="#minetestitem_eat"name="minetestitem_eat">#</a>Called when an item is eaten, by <code>minetest.item_eat</code></li>
<li><aclass="anchor"href="#minetestitem_eat"name="minetestitem_eat">#</a>Called when an item is eaten, by <code>minetest.item_eat</code></li>
<li><aclass="anchor"href="#true_8" name="true_8">#</a>Return <code>true</code> or <code>itemstack</code> to cancel the default item eat response (i.e.: hp increase)</li>
<li><aclass="anchor"href="#true_9" name="true_9">#</a>Return <code>true</code> or <code>itemstack</code> to cancel the default item eat response (i.e.: hp increase)</li>
<li><aclass="anchor"href="#minetestbuiltin_auth_handler"name="minetestbuiltin_auth_handler">#</a>See <code>minetest.builtin_auth_handler</code> in <code>builtin.lua</code> for reference</li>
<li>Registers an auth handler that overrides the builtin one</li>
<li>This function can be called by a single mod once only.</li>
</ul>
</ul>
</li>
</li>
</ul>
</ul>
@ -3010,47 +3072,66 @@ The file should be a text file, with the following format:</p>
<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><aclass="anchor"href="#minetestcheck_password_entry"name="minetestcheck_password_entry">#</a>For this purpose, use <code>minetest.check_password_entry</code> instead.</li>
<li><aclass="anchor"href="#player_or_name"name="player_or_name">#</a><code>player_or_name</code>: Either a Player object or the name of a player.</li>
<li><aclass="anchor"href="#player_or_name"name="player_or_name">#</a><code>player_or_name</code>: Either a Player object or the name of a player.</li>
<li><code>...</code> is either a list of strings, e.g. <code>"priva", "privb"</code> or
<li><code>...</code> is either a list of strings, e.g. <code>"priva", "privb"</code> or
a table, e.g. <code>{ priva = true, privb = true }</code>.</li>
a table, e.g. <code>{ priva = true, privb = true }</code>.</li>
</ul>
</ul>
</li>
</li>
<li><aclass="anchor"href="#minetestget_player_ipname"name="minetestget_player_ipname">#</a><code>minetest.get_player_ip(name)</code>: returns an IP address string</li>
<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
on comparing the password hash in the database with the password hash
from the function, with an externally provided password, as the hash
in the db might use the new SRP verifier format.</li>
<li><aclass="anchor"href="#minetestcheck_password_entry"name="minetestcheck_password_entry">#</a>For this purpose, use <code>minetest.check_password_entry</code> instead.</li>
<p><code>minetest.get_auth_handler()</code>: Return the currently active auth handler</p>
<ul>
<li><aclass="anchor"href="#Authenticationhandlerdefinition"name="Authenticationhandlerdefinition">#</a>See the <code>Authentication handler definition</code></li>
<li><aclass="anchor"href="#localauth_dataminetestget_auth_handlerget_authplayername"name="localauth_dataminetestget_auth_handlerget_authplayername">#</a>Use this to e.g. get the authentication data for a player:
<li>Must be called by the authentication handler for privilege changes.</li>
<li><aclass="anchor"href="#name_13"name="name_13">#</a><code>name</code>: string; if omitted, all auth data should be considered modified</li>
</ul>
</li>
<li><aclass="anchor"href="#minetestset_player_passwordnamepassword_hash"name="minetestset_player_passwordnamepassword_hash">#</a><code>minetest.set_player_password(name, password_hash)</code>: Set password hash of player <code>name</code></li>
<li><aclass="anchor"href="#minetestset_player_privsnamepriv1true"name="minetestset_player_privsnamepriv1true">#</a><code>minetest.set_player_privs(name, {priv1=true,...})</code>: Set privileges of player <code>name</code></li>
<li><aclass="anchor"href="#Raycast"name="Raycast">#</a>Creates a <code>Raycast</code> object.</li>
<li><aclass="anchor"href="#Raycast"name="Raycast">#</a>Creates a <code>Raycast</code> object.</li>
<li><aclass="anchor"href="#pos1_5" name="pos1_5">#</a><code>pos1</code>: start of the ray</li>
<li><aclass="anchor"href="#pos1_4" name="pos1_4">#</a><code>pos1</code>: start of the ray</li>
<li><aclass="anchor"href="#pos2_1"name="pos2_1">#</a><code>pos2</code>: end of the ray</li>
<li><aclass="anchor"href="#pos2_1"name="pos2_1">#</a><code>pos2</code>: end of the ray</li>
<li><aclass="anchor"href="#objects"name="objects">#</a><code>objects</code> : if false, only nodes will be returned. Default is <code>true</code>.</li>
<li><aclass="anchor"href="#objects"name="objects">#</a><code>objects</code> : if false, only nodes will be returned. Default is <code>true</code>.</li>
<li><aclass="anchor"href="#liquidsiffalseliquidnodeswontbereturnedDefaultis"name="liquidsiffalseliquidnodeswontbereturnedDefaultis">#</a><code>liquids' : if false, liquid nodes won't be returned. Default is</code>false`.</li>
<li><aclass="anchor"href="#liquidsiffalseliquidnodeswontbereturnedDefaultis"name="liquidsiffalseliquidnodeswontbereturnedDefaultis">#</a><code>liquids' : if false, liquid nodes won't be returned. Default is</code>false`.</li>
@ -3323,8 +3403,8 @@ and <code>minetest.auth_reload</code> call the authentication handler.</p>
<li><aclass="anchor"href="#pos1_6" name="pos1_6">#</a>returns a table of 3D points representing a path from <code>pos1</code> to <code>pos2</code> or <code>nil</code></li>
<li><aclass="anchor"href="#pos1_5" name="pos1_5">#</a>returns a table of 3D points representing a path from <code>pos1</code> to <code>pos2</code> or <code>nil</code></li>
<li><aclass="anchor"href="#pos2_2"name="pos2_2">#</a><code>pos2</code>: end position</li>
<li><aclass="anchor"href="#pos2_2"name="pos2_2">#</a><code>pos2</code>: end position</li>
<li><aclass="anchor"href="#searchdistance"name="searchdistance">#</a><code>searchdistance</code>: number of blocks to search in each direction using a maximum metric</li>
<li><aclass="anchor"href="#searchdistance"name="searchdistance">#</a><code>searchdistance</code>: number of blocks to search in each direction using a maximum metric</li>
<li><aclass="anchor"href="#max_jump"name="max_jump">#</a><code>max_jump</code>: maximum height difference to consider walkable</li>
<li><aclass="anchor"href="#max_jump"name="max_jump">#</a><code>max_jump</code>: maximum height difference to consider walkable</li>
@ -3363,7 +3443,7 @@ and <code>minetest.auth_reload</code> call the authentication handler.</p>
<li>resets the light in a cuboid-shaped part of
<li>resets the light in a cuboid-shaped part of
the map and removes lighting bugs.</li>
the map and removes lighting bugs.</li>
<li>Loads the area if it is not loaded.</li>
<li>Loads the area if it is not loaded.</li>
<li><aclass="anchor"href="#pos1_8" name="pos1_8">#</a><code>pos1</code> is the corner of the cuboid with the least coordinates
<li><aclass="anchor"href="#pos1_7" name="pos1_7">#</a><code>pos1</code> is the corner of the cuboid with the least coordinates
(in node coordinates), inclusive.</li>
(in node coordinates), inclusive.</li>
<li><aclass="anchor"href="#pos2_3"name="pos2_3">#</a><code>pos2</code> is the opposite corner of the cuboid, inclusive.</li>
<li><aclass="anchor"href="#pos2_3"name="pos2_3">#</a><code>pos2</code> is the opposite corner of the cuboid, inclusive.</li>
<li>The actual updated cuboid might be larger than the specified one,
<li>The actual updated cuboid might be larger than the specified one,
@ -3514,7 +3594,7 @@ and <code>minetest.auth_reload</code> call the authentication handler.</p>
<li><aclass="anchor"href="#true_12" name="true_12">#</a>Returns a boolean. Returns <code>true</code> if the given <code>paramtype2</code> contains color
<li><aclass="anchor"href="#true_13" name="true_13">#</a>Returns a boolean. Returns <code>true</code> if the given <code>paramtype2</code> contains color
information (<code>color</code>, <code>colorwallmounted</code> or <code>colorfacedir</code>).</li>
information (<code>color</code>, <code>colorwallmounted</code> or <code>colorfacedir</code>).</li>
</ul>
</ul>
</li>
</li>
@ -3681,8 +3761,8 @@ and <code>minetest.auth_reload</code> call the authentication handler.</p>
<li><aclass="anchor"href="#func" name="func">#</a>Call the function <code>func</code> after <code>time</code> seconds, may be fractional</li>
<li><aclass="anchor"href="#func_1" name="func_1">#</a>Call the function <code>func</code> after <code>time</code> seconds, may be fractional</li>
<li><aclass="anchor"href="#func_1" name="func_1">#</a>Optional: Variable number of arguments that are passed to <code>func</code></li>
<li><aclass="anchor"href="#func_2" name="func_2">#</a>Optional: Variable number of arguments that are passed to <code>func</code></li>
</ul>
</ul>
</li>
</li>
</ul>
</ul>
@ -3697,10 +3777,15 @@ and <code>minetest.auth_reload</code> call the authentication handler.</p>
<li><aclass="anchor"href="#minetestget_server_status"name="minetestget_server_status">#</a><code>minetest.get_server_status()</code>: returns server status string</li>
<li><aclass="anchor"href="#minetestget_server_status"name="minetestget_server_status">#</a><code>minetest.get_server_status()</code>: returns server status string</li>
<li><aclass="anchor"href="#minetestget_server_uptime"name="minetestget_server_uptime">#</a><code>minetest.get_server_uptime()</code>: returns the server uptime in seconds</li>
<li><aclass="anchor"href="#minetestget_server_uptime"name="minetestget_server_uptime">#</a><code>minetest.get_server_uptime()</code>: returns the server uptime in seconds</li>
<li><aclass="anchor"href="#minetestremove_playername"name="minetestremove_playername">#</a><code>minetest.remove_player(name)</code>: remove player from database (if he is not connected).<ul>
<li><aclass="anchor"href="#minetestremove_playername"name="minetestremove_playername">#</a><code>minetest.remove_player(name)</code>: remove player from database (if he is not connected).<ul>
<li>Does not remove player authentication data, minetest.player_exists will continue to return true.</li>
<li>As auth data is not removed, minetest.player_exists will continue to return true.
Call the below method as well if you want to remove auth data too.</li>
<li>Returns a code (0: successful, 1: no such player, 2: player is connected)</li>
<li>Returns a code (0: successful, 1: no such player, 2: player is connected)</li>
</ul>
</ul>
</li>
</li>
<li><aclass="anchor"href="#minetestremove_player_authname"name="minetestremove_player_authname">#</a><code>minetest.remove_player_auth(name)</code>: remove player authentication data<ul>
<li>Returns boolean indicating success (false if player nonexistant)</li>
</ul>
</li>
</ul>
</ul>
<h3id="bans">Bans</h3>
<h3id="bans">Bans</h3>
<ul>
<ul>
@ -3789,12 +3874,16 @@ and <code>minetest.auth_reload</code> call the authentication handler.</p>
<li><aclass="anchor"href="#force_placement_1"name="force_placement_1">#</a><code>force_placement</code> is a boolean indicating whether nodes other than <code>air</code> and
<li><aclass="anchor"href="#force_placement_1"name="force_placement_1">#</a><code>force_placement</code> is a boolean indicating whether nodes other than <code>air</code> and
<code>ignore</code> are replaced by the schematic</li>
<code>ignore</code> are replaced by the schematic</li>
<li>Returns nil if the schematic could not be loaded.</li>
<li>Returns nil if the schematic could not be loaded.</li>
<li><strong>Warning</strong>: Once you have loaded a schematic from a file, it will be cached. Future calls
will always use the cached version and the replacement list defined for it,
regardless of whether the file or the replacement list parameter have changed.
The only way to load the file anew is to restart the server.</li>
<li><aclass="anchor"href="#name_18"name="name_18">#</a>Returns true, if player <code>name</code> shouldn't be abled to dig at <code>pos</code> or do other
<li><aclass="anchor"href="#name_18"name="name_18">#</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.
actions, definable by mods, due to some mod-defined ownership-like concept.
Returns false or nil, if the player is allowed to do such actions.</li>
Returns false or nil, if the player is allowed to do such actions.</li>
<li><aclass="anchor"href="#name_19"name="name_19">#</a><code>name</code> will be "" for non-players or unknown players.</li>
<li><aclass="anchor"href="#name_19"name="name_19">#</a><code>name</code> will be "" for non-players or unknown players.</li>
<li>This function should be overridden by protection mods and should be used to
<li>This function should be overridden by protection mods and should be used to
<li><aclass="anchor"href="#true_15" name="true_15">#</a>returns <code>true</code> if this metadata has the same key-value pairs as <code>other</code></li>
<li><aclass="anchor"href="#true_16" name="true_16">#</a>returns <code>true</code> if this metadata has the same key-value pairs as <code>other</code></li>
</ul>
</ul>
</li>
</li>
</ul>
</ul>
@ -4221,7 +4310,7 @@ Can be gotten via <code>minetest.get_node_timer(pos)</code>.</p>
</ul>
</ul>
</li>
</li>
<li><aclass="anchor"href="#is_started"name="is_started">#</a><code>is_started()</code>: returns boolean state of timer<ul>
<li><aclass="anchor"href="#is_started"name="is_started">#</a><code>is_started()</code>: returns boolean state of timer<ul>
<li><aclass="anchor"href="#true_16" name="true_16">#</a>returns <code>true</code> if timer is started, otherwise <code>false</code></li>
<li><aclass="anchor"href="#true_17" name="true_17">#</a>returns <code>true</code> if timer is started, otherwise <code>false</code></li>
</ul>
</ul>
</li>
</li>
</ul>
</ul>
@ -4425,7 +4514,7 @@ Can be gotten via <code>minetest.get_node_timer(pos)</code>.</p>
<li><aclass="anchor"href="#hud_set_flagsflags"name="hud_set_flagsflags">#</a><code>hud_set_flags(flags)</code>: sets specified HUD flags to <code>true</code>/<code>false</code><ul>
<li><aclass="anchor"href="#hud_set_flagsflags"name="hud_set_flagsflags">#</a><code>hud_set_flags(flags)</code>: sets specified HUD flags to <code>true</code>/<code>false</code><ul>
<li><aclass="anchor"href="#true_17" name="true_17">#</a>pass a table containing a <code>true</code>/<code>false</code> value of each flag to be set or unset</li>
<li><aclass="anchor"href="#true_18" name="true_18">#</a>pass a table containing a <code>true</code>/<code>false</code> value of each flag to be set or unset</li>
<li><aclass="anchor"href="#nil_7"name="nil_7">#</a>if a flag equals <code>nil</code>, the flag is not modified</li>
<li><aclass="anchor"href="#nil_7"name="nil_7">#</a>if a flag equals <code>nil</code>, the flag is not modified</li>
<li><aclass="anchor"href="#minimap"name="minimap">#</a>note that setting <code>minimap</code> modifies the client's permission to view the minimap -</li>
<li><aclass="anchor"href="#minimap"name="minimap">#</a>note that setting <code>minimap</code> modifies the client's permission to view the minimap -</li>
<li>the client may locally elect to not view the minimap</li>
<li>the client may locally elect to not view the minimap</li>
@ -4485,10 +4574,8 @@ Can be gotten via <code>minetest.get_node_timer(pos)</code>.</p>
</ul>
</ul>
</li>
</li>
<li><aclass="anchor"href="#get_day_night_ratio"name="get_day_night_ratio">#</a><code>get_day_night_ratio()</code>: returns the ratio or nil if it isn't overridden</li>
<li><aclass="anchor"href="#get_day_night_ratio"name="get_day_night_ratio">#</a><code>get_day_night_ratio()</code>: returns the ratio or nil if it isn't overridden</li>
@ -4696,25 +4783,25 @@ for 2D noise, and it must be must be larger than 1 for 3D noise (otherwise
nil, this table will be used to store the result instead of creating a new table.</p>
nil, this table will be used to store the result instead of creating a new table.</p>
<h4id="methods_14">Methods</h4>
<h4id="methods_14">Methods</h4>
<ul>
<ul>
<li><aclass="anchor"href="#get2dMappos" name="get2dMappos">#</a><code>get2dMap(pos)</code>: returns a <code><size.x></code> times <code><size.y></code> 2D array of 2D noise
<li><aclass="anchor"href="#get_2d_mappos" name="get_2d_mappos">#</a><code>get_2d_map(pos)</code>: returns a <code><size.x></code> times <code><size.y></code> 2D array of 2D noise
with values starting at <code>pos={x=,y=}</code></li>
with values starting at <code>pos={x=,y=}</code></li>
<li><aclass="anchor"href="#get3dMappos" name="get3dMappos">#</a><code>get3dMap(pos)</code>: returns a <code><size.x></code> times <code><size.y></code> times <code><size.z></code> 3D array
<li><aclass="anchor"href="#get_3d_mappos" name="get_3d_mappos">#</a><code>get_3d_map(pos)</code>: returns a <code><size.x></code> times <code><size.y></code> times <code><size.z></code> 3D array
of 3D noise with values starting at <code>pos={x=,y=,z=}</code></li>
of 3D noise with values starting at <code>pos={x=,y=,z=}</code></li>
<li><aclass="anchor"href="#get2dMap_flatposbuffer" name="get2dMap_flatposbuffer">#</a><code>get2dMap_flat(pos, buffer)</code>: returns a flat <code><size.x * size.y></code> element array of 2D noise
<li><aclass="anchor"href="#get_2d_map_flatposbuffer" name="get_2d_map_flatposbuffer">#</a><code>get_2d_map_flat(pos, buffer)</code>: returns a flat <code><size.x * size.y></code> element array of 2D noise
with values starting at <code>pos={x=,y=}</code></li>
with values starting at <code>pos={x=,y=}</code></li>
<li><aclass="anchor"href="#get3dMap_flatposbuffer" name="get3dMap_flatposbuffer">#</a><code>get3dMap_flat(pos, buffer)</code>: Same as <code>get2dMap_flat</code>, but 3D noise</li>
<li><aclass="anchor"href="#get_3d_map_flatposbuffer" name="get_3d_map_flatposbuffer">#</a><code>get_3d_map_flat(pos, buffer)</code>: Same as <code>get2dMap_flat</code>, but 3D noise</li>
<li><aclass="anchor"href="#calc2dMappos" name="calc2dMappos">#</a><code>calc2dMap(pos)</code>: Calculates the 2d noise map starting at <code>pos</code>. The result is stored internally.</li>
<li><aclass="anchor"href="#calc_2d_mappos" name="calc_2d_mappos">#</a><code>calc_2d_map(pos)</code>: Calculates the 2d noise map starting at <code>pos</code>. The result is stored internally.</li>
<li><aclass="anchor"href="#calc3dMappos" name="calc3dMappos">#</a><code>calc3dMap(pos)</code>: Calculates the 3d noise map starting at <code>pos</code>. The result is stored internally.</li>
<li><aclass="anchor"href="#calc_3d_mappos" name="calc_3d_mappos">#</a><code>calc_3d_map(pos)</code>: Calculates the 3d noise map starting at <code>pos</code>. The result is stored internally.</li>
<li><aclass="anchor"href="#getMapSliceslice_offsetslice_sizebuffer" name="getMapSliceslice_offsetslice_sizebuffer">#</a><code>getMapSlice(slice_offset, slice_size, buffer)</code>: In the form of an array, returns a slice of the
<li><aclass="anchor"href="#get_map_sliceslice_offsetslice_sizebuffer" name="get_map_sliceslice_offsetslice_sizebuffer">#</a><code>get_map_slice(slice_offset, slice_size, buffer)</code>: In the form of an array, returns a slice of the
most recently computed noise results. The result slice begins at coordinates <code>slice_offset</code> and
most recently computed noise results. The result slice begins at coordinates <code>slice_offset</code> and
takes a chunk of <code>slice_size</code>.
takes a chunk of <code>slice_size</code>.
E.g. to grab a 2-slice high horizontal 2d plane of noise starting at buffer offset y = 20:
E.g. to grab a 2-slice high horizontal 2d plane of noise starting at buffer offset y = 20:
@ -4871,7 +4958,7 @@ will place the schematic inside of the VoxelManip.</p>
<li><aclass="anchor"href="#set_lightinglightp1p2"name="set_lightinglightp1p2">#</a><code>set_lighting(light, [p1, p2])</code>: Set the lighting within the <code>VoxelManip</code> to a uniform value<ul>
<li><aclass="anchor"href="#set_lightinglightp1p2"name="set_lightinglightp1p2">#</a><code>set_lighting(light, [p1, p2])</code>: Set the lighting within the <code>VoxelManip</code> to a uniform value<ul>
<li><aclass="anchor"href="#light_1"name="light_1">#</a><code>light</code> is a table, <code>{day=<0...15>, night=<0...15>}</code></li>
<li><aclass="anchor"href="#light_1"name="light_1">#</a><code>light</code> is a table, <code>{day=<0...15>, night=<0...15>}</code></li>
<li><aclass="anchor"href="#VoxelManip"name="VoxelManip">#</a>To be used only by a <code>VoxelManip</code> object from <code>minetest.get_mapgen_object</code></li>
<li><aclass="anchor"href="#VoxelManip"name="VoxelManip">#</a>To be used only by a <code>VoxelManip</code> object from <code>minetest.get_mapgen_object</code></li>
<li><aclass="anchor"href="#p1" name="p1">#</a>(<code>p1</code>, <code>p2</code>) is the area in which lighting is set;
<li><aclass="anchor"href="#p1_3" name="p1_3">#</a>(<code>p1</code>, <code>p2</code>) is the area in which lighting is set;
defaults to the whole area if left out</li>
defaults to the whole area if left out</li>
</ul>
</ul>
</li>
</li>
@ -4894,7 +4981,7 @@ will place the schematic inside of the VoxelManip.</p>
<li><aclass="anchor"href="#set_param2_dataparam2_data"name="set_param2_dataparam2_data">#</a><code>set_param2_data(param2_data)</code>: Sets the <code>param2</code> contents of each node in the <code>VoxelManip</code></li>
<li><aclass="anchor"href="#set_param2_dataparam2_data"name="set_param2_dataparam2_data">#</a><code>set_param2_data(param2_data)</code>: Sets the <code>param2</code> contents of each node in the <code>VoxelManip</code></li>
<li><aclass="anchor"href="#calc_lightingp1p2propagate_shadow"name="calc_lightingp1p2propagate_shadow">#</a><code>calc_lighting([p1, p2], [propagate_shadow])</code>: Calculate lighting within the <code>VoxelManip</code><ul>
<li><aclass="anchor"href="#calc_lightingp1p2propagate_shadow"name="calc_lightingp1p2propagate_shadow">#</a><code>calc_lighting([p1, p2], [propagate_shadow])</code>: Calculate lighting within the <code>VoxelManip</code><ul>
<li><aclass="anchor"href="#VoxelManip_1"name="VoxelManip_1">#</a>To be used only by a <code>VoxelManip</code> object from <code>minetest.get_mapgen_object</code></li>
<li><aclass="anchor"href="#VoxelManip_1"name="VoxelManip_1">#</a>To be used only by a <code>VoxelManip</code> object from <code>minetest.get_mapgen_object</code></li>
<li><aclass="anchor"href="#p1_1" name="p1_1">#</a>(<code>p1</code>, <code>p2</code>) is the area in which lighting is set; defaults to the whole area
<li><aclass="anchor"href="#p1_4" name="p1_4">#</a>(<code>p1</code>, <code>p2</code>) is the area in which lighting is set; defaults to the whole area
if left out or nil</li>
if left out or nil</li>
<li><aclass="anchor"href="#propagate_shadow"name="propagate_shadow">#</a><code>propagate_shadow</code> is an optional boolean deciding whether shadows in a generated
<li><aclass="anchor"href="#propagate_shadow"name="propagate_shadow">#</a><code>propagate_shadow</code> is an optional boolean deciding whether shadows in a generated
mapchunk above are propagated down into the mapchunk; defaults to <code>true</code> if left out</li>
mapchunk above are propagated down into the mapchunk; defaults to <code>true</code> if left out</li>
@ -4937,7 +5024,11 @@ The coordinates are <em>inclusive</em>, like most other things in Minetest.</p>
<h4id="methods_17">Methods</h4>
<h4id="methods_17">Methods</h4>
<ul>
<ul>
<li><aclass="anchor"href="#getkey"name="getkey">#</a><code>get(key)</code>: returns a value</li>
<li><aclass="anchor"href="#getkey"name="getkey">#</a><code>get(key)</code>: returns a value</li>
<li><aclass="anchor"href="#get_boolkey"name="get_boolkey">#</a><code>get_bool(key)</code>: returns a boolean</li>
<li><aclass="anchor"href="#get_boolkeydefault"name="get_boolkeydefault">#</a><code>get_bool(key, [default])</code>: returns a boolean<ul>
<li><aclass="anchor"href="#default_2"name="default_2">#</a><code>default</code> is the value returned if <code>key</code> is not found.</li>
<li><aclass="anchor"href="#nil_9"name="nil_9">#</a>Returns <code>nil</code> if <code>key</code> is not found and <code>default</code> not specified.</li>
</ul>
</li>
<li><aclass="anchor"href="#get_np_groupkey"name="get_np_groupkey">#</a><code>get_np_group(key)</code>: returns a NoiseParams table</li>
<li><aclass="anchor"href="#get_np_groupkey"name="get_np_groupkey">#</a><code>get_np_group(key)</code>: returns a NoiseParams table</li>