Update lua_api.html
This commit is contained in:
parent
74086b4902
commit
f3c8c5a582
81
lua_api.html
81
lua_api.html
@ -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:<n>:<p></a></li>
|
||||
<li><a href="#combinewxhx1y1file1x2y2file2">[combine:<w>x<h>:<x1>,<y1>=<file1>:<x2>,<y2>=<file2>:...</a></li>
|
||||
<li><a href="#resizewxh">[resize:<w>x<h></a></li>
|
||||
<li><a href="#opacityr">[opacity:<r></a></li>
|
||||
<li><a href="#brighten">[brighten</a></li>
|
||||
<li><a href="#noalpha">[noalpha</a></li>
|
||||
<li><a href="#makealphargb">[makealpha:<r>,<g>,<b></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[<color>;<fullscreen>]</a></li>
|
||||
<li><a href="#backgroundxywhtexture-name">background[<X>,<Y>;<W>,<H>;<texture name>]</a></li>
|
||||
<li><a href="#backgroundxywhtexture-nameauto_clip">background[<X>,<Y>;<W>,<H>;<texture name>;<auto_clip>]</a></li>
|
||||
<li><a href="#pwdfieldxywhnamelabel">pwdfield[<X>,<Y>;<W>,<H>;<name>;<label>]</a></li>
|
||||
<li><a href="#fieldxywhnamelabeldefault">field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]</a></li>
|
||||
<li><a href="#fieldnamelabeldefault">field[<name>;<label>;<default>]</a></li>
|
||||
<li><a href="#pwdfieldxywhnamelabelclose_on_enter">pwdfield[<X>,<Y>;<W>,<H>;<name>;<label>;<close_on_enter>]</a></li>
|
||||
<li><a href="#fieldxywhnamelabeldefaultclose_on_enter">field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>;<close_on_enter>]</a></li>
|
||||
<li><a href="#fieldnamelabeldefaultclose_on_enter">field[<name>;<label>;<default>;<close_on_enter>]</a></li>
|
||||
<li><a href="#textareaxywhnamelabeldefault">textarea[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]</a></li>
|
||||
<li><a href="#labelxylabel">label[<X>,<Y>;<label>]</a></li>
|
||||
<li><a href="#vertlabelxylabel">vertlabel[<X>,<Y>;<label>]</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:<r></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[<X>,<Y>;<W>,<H>;<name>;<label>]</code></h4>
|
||||
<h4 id="pwdfieldxywhnamelabelclose_on_enter"><code>pwdfield[<X>,<Y>;<W>,<H>;<name>;<label>;<close_on_enter>]</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[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]</code></h4>
|
||||
<h4 id="fieldxywhnamelabeldefaultclose_on_enter"><code>field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>;<close_on_enter>]</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[<name>;<label>;<default>]</code></h4>
|
||||
<h4 id="fieldnamelabeldefaultclose_on_enter"><code>field[<name>;<label>;<default>;<close_on_enter>]</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[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]</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,
|
||||
--[[
|
||||
|
@ -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...")
|
||||
|
Loading…
Reference in New Issue
Block a user