Update lua_api.html

This commit is contained in:
rubenwardy 2016-08-29 13:43:46 +01:00
parent 74086b4902
commit f3c8c5a582
2 changed files with 61 additions and 21 deletions

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 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>
This page was last updated 29/August/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>
@ -43,6 +43,7 @@ This page was last updated 22/July/2016.<br />See <a href="https://github.com/mi
<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="#opacityr">[opacity:&lt;r&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>
@ -173,9 +174,9 @@ This page was last updated 22/July/2016.<br />See <a href="https://github.com/mi
<li><a href="#bgcolorcolorfullscreen">bgcolor[&lt;color&gt;;&lt;fullscreen&gt;]</a></li>
<li><a href="#backgroundxywhtexture-name">background[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;texture name&gt;]</a></li>
<li><a href="#backgroundxywhtexture-nameauto_clip">background[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;texture name&gt;;&lt;auto_clip&gt;]</a></li>
<li><a href="#pwdfieldxywhnamelabel">pwdfield[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;label&gt;]</a></li>
<li><a href="#fieldxywhnamelabeldefault">field[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;label&gt;;&lt;default&gt;]</a></li>
<li><a href="#fieldnamelabeldefault">field[&lt;name&gt;;&lt;label&gt;;&lt;default&gt;]</a></li>
<li><a href="#pwdfieldxywhnamelabelclose_on_enter">pwdfield[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;label&gt;;&lt;close_on_enter&gt;]</a></li>
<li><a href="#fieldxywhnamelabeldefaultclose_on_enter">field[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;label&gt;;&lt;default&gt;;&lt;close_on_enter&gt;]</a></li>
<li><a href="#fieldnamelabeldefaultclose_on_enter">field[&lt;name&gt;;&lt;label&gt;;&lt;default&gt;;&lt;close_on_enter&gt;]</a></li>
<li><a href="#textareaxywhnamelabeldefault">textarea[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;label&gt;;&lt;default&gt;]</a></li>
<li><a href="#labelxylabel">label[&lt;X&gt;,&lt;Y&gt;;&lt;label&gt;]</a></li>
<li><a href="#vertlabelxylabel">vertlabel[&lt;X&gt;,&lt;Y&gt;;&lt;label&gt;]</a></li>
@ -363,7 +364,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 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>
</ul>This page was last updated 29/August/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>
@ -486,7 +487,8 @@ empty, except for lines starting with <code>#</code>, which are comments.</p>
to a single modname. Their meaning is that if the specified mod
is missing, that does not prevent this mod from being loaded.</p>
<h3 id="screenshotpng"><code>screenshot.png</code></h3>
<p>A screenshot shown in modmanager within mainmenu.</p>
<p>A screenshot shown in the mod manager within the main menu. It should
have an aspect ratio of 3:2 and a minimum size of 300×200 pixels.</p>
<h3 id="descriptiontxt"><code>description.txt</code></h3>
<p>A File containing description to be shown within mainmenu.</p>
<h3 id="settingtypestxt"><code>settingtypes.txt</code></h3>
@ -585,6 +587,15 @@ specified coordinates.</p>
<p>Example:</p>
<pre><code>default_sandstone.png^[resize:16x16
</code></pre>
<h4 id="opacityr"><code>[opacity:&lt;r&gt;</code></h4>
<pre><code>Makes the base image transparent according to the given ratio.
r must be between 0 and 255.
0 means totally transparent.
255 means totally opaque.
</code></pre>
<p>Example:</p>
<pre><code>default_sandstone.png^[opacity:127
</code></pre>
<h4 id="brighten"><code>[brighten</code></h4>
<p>Brightens the texture.</p>
<p>Example:</p>
@ -862,6 +873,22 @@ paramtype2 == "degrotate"
^ The rotation of this node is stored in param2. Plants are rotated this way.
Values range 0 - 179. The value stored in param2 is multiplied by two to
get the actual rotation of the node.
paramtype2 == "meshoptions"
^ Only valid for "plantlike". The value of param2 becomes a bitfield which can
be used to change how the client draws plantlike nodes. Bits 0, 1 and 2 form
a mesh selector. Currently the following meshes are choosable:
0 = a "x" shaped plant (ordinary plant)
1 = a "+" shaped plant (just rotated 45 degrees)
2 = a "*" shaped plant with 3 faces instead of 2
3 = a "#" shaped plant with 4 faces instead of 2
4 = a "#" shaped plant with 4 faces that lean outwards
5-7 are unused and reserved for future meshes.
Bits 3 through 7 are optional flags that can be combined and give these
effects:
bit 3 (0x08) - Makes the plant slightly vary placement horizontally
bit 4 (0x10) - Makes the plant mesh 1.4x larger
bit 5 (0x20) - Moves each face randomly a small bit down (1/8 max)
bits 6-7 are reserved for future use.
collision_box = {
type = "fixed",
fixed = {
@ -1648,19 +1675,25 @@ list[current_player;craftpreview;7,1;1,1;]
<li><a class="anchor" href="#true_1" name="true_1">#</a>If <code>true</code> the background is clipped to formspec size
(<code>x</code> and <code>y</code> are used as offset values, <code>w</code> and <code>h</code> are ignored)</li>
</ul>
<h4 id="pwdfieldxywhnamelabel"><code>pwdfield[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;label&gt;]</code></h4>
<h4 id="pwdfieldxywhnamelabelclose_on_enter"><code>pwdfield[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;label&gt;;&lt;close_on_enter&gt;]</code></h4>
<ul>
<li>Textual password style field; will be sent to server when a button is clicked</li>
<li>When enter is pressed in field, fields.key_enter_field will be sent with the name
of this field.</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>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>
<li><a class="anchor" href="#close_on_enter" name="close_on_enter">#</a><code>close_on_enter</code> (optional) is whether the form should accept and close when enter is
pressed in this field. Defaults to true.</li>
</ul>
<h4 id="fieldxywhnamelabeldefault"><code>field[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;label&gt;;&lt;default&gt;]</code></h4>
<h4 id="fieldxywhnamelabeldefaultclose_on_enter"><code>field[&lt;X&gt;,&lt;Y&gt;;&lt;W&gt;,&lt;H&gt;;&lt;name&gt;;&lt;label&gt;;&lt;default&gt;;&lt;close_on_enter&gt;]</code></h4>
<ul>
<li>Textual field; will be sent to server when a button is clicked</li>
<li>When enter is pressed in field, fields.key_enter_field will be sent with the name
of this field.</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>
@ -1673,13 +1706,19 @@ list[current_player;craftpreview;7,1;1,1;]
<li><strong>Note</strong>: no extra text or more than a single variable is supported ATM.</li>
</ul>
</li>
<li><a class="anchor" href="#close_on_enter_1" name="close_on_enter_1">#</a><code>close_on_enter</code> (optional) is whether the form should accept and close when enter is
pressed in this field. Defaults to true.</li>
</ul>
<h4 id="fieldnamelabeldefault"><code>field[&lt;name&gt;;&lt;label&gt;;&lt;default&gt;]</code></h4>
<h4 id="fieldnamelabeldefaultclose_on_enter"><code>field[&lt;name&gt;;&lt;label&gt;;&lt;default&gt;;&lt;close_on_enter&gt;]</code></h4>
<ul>
<li>As above, but without position/size units</li>
<li>When enter is pressed in field, fields.key_enter_field will be sent with the name
of this field.</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><a class="anchor" href="#close_on_enter_2" name="close_on_enter_2">#</a><code>close_on_enter</code> (optional) is whether the form should accept and close when enter is
pressed in this field. Defaults to true.</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>
@ -2276,7 +2315,7 @@ The following functions provide escape sequences:
<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}</code>
the default of <code>give_to_singleplayer</code> is true </li>
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>
@ -3244,6 +3283,7 @@ Can be gotten via <code>minetest.get_meta(pos)</code>.</p>
<li><a class="anchor" href="#get_inventory" name="get_inventory">#</a><code>get_inventory()</code>: returns <code>InvRef</code></li>
<li><a class="anchor" href="#to_table" name="to_table">#</a><code>to_table()</code>: returns <code>nil</code> or <code>{fields = {...}, inventory = {list1 = {}, ...}}</code></li>
<li><a class="anchor" href="#from_tablenilor" name="from_tablenilor">#</a><code>from_table(nil or {})</code><ul>
<li>to clear metadata, use from_table(nil)</li>
<li>See "Node Metadata"</li>
</ul>
</li>
@ -4163,27 +4203,26 @@ minetest.spawn_tree(pos,apple_tree)
<h3 id="item-definition-register_node-register_craftitem-register_tool">Item definition (<code>register_node</code>, <code>register_craftitem</code>, <code>register_tool</code>)</h3>
<pre><code>{
description = "Steel Axe",
groups = {}, -- key=name, value=rating; rating=1..3.
groups = {}, -- key = name, value = rating; rating = 1..3.
if rating not applicable, use 1.
e.g. {wool=1, fluffy=3}
{soil=2, outerspace=1, crumbly=1}
{bendy=2, snappy=1},
{hard=1, metal=1, spikes=1}
e.g. {wool = 1, fluffy = 3}
{soil = 2, outerspace = 1, crumbly = 1}
{bendy = 2, snappy = 1},
{hard = 1, metal = 1, spikes = 1}
inventory_image = "default_tool_steelaxe.png",
wield_image = "",
wield_scale = {x=1,y=1,z=1},
wield_scale = {x = 1, y = 1, z = 1},
stack_max = 99,
range = 4.0,
liquids_pointable = false,
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=0,
groupcaps={
max_drop_level = 0,
groupcaps = {
-- For example:
snappy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1},
choppy={times={[3]=0.90}, maxwear=0.05, maxlevel=0}
choppy = {times = {[1] = 2.50, [2] = 1.40, [3] = 1.00}, uses = 20, maxlevel = 2},
},
damage_groups = {groupname=damage},
damage_groups = {groupname = damage},
},
node_placement_prediction = nil,
--[[

View File

@ -29,6 +29,7 @@ print("Downloading lua_api.txt...")
url = "https://raw.githubusercontent.com/minetest/minetest/master/doc/lua_api.txt"
text = urllib2.urlopen(url).read()
text = unicode(text, "utf-8")
print("Pre-generation replacements...")