diff --git a/lua_api.html b/lua_api.html index 6bd2696..caeeefd 100644 --- a/lua_api.html +++ b/lua_api.html @@ -4,7 +4,7 @@ layout: default ---

This is lua_api.txt nicely formated: I did not write this

-This page was last updated 12/November/2016.
See doc/lua_api.txt for the latest version (in plaintext).
Generated using a Python script.
+This page was last updated 28/December/2016.
See doc/lua_api.txt for the latest version (in plaintext).
Generated using a Python script.

Table of Contents

This page was last updated 28/December/2016.
See doc/lua_api.txt for the latest version (in plaintext).
Generated using a Python script.

Programming in Lua

If you have any difficulty in understanding this, please read Programming in Lua.

Startup

@@ -710,18 +711,24 @@ from the available ones of the following files:

  • #foomod_foosound.9.ogg
  • Examples of sound parameter tables:

    -
    -- Play location-less on all clients
    +
    -- Play locationless on all clients
     {
         gain = 1.0, -- default
     }
    --- Play location-less to a player
    +-- Play locationless to one player
     {
         to_player = name,
         gain = 1.0, -- default
     }
    +-- Play locationless to one player, looped
    +{
    +    to_player = name,
    +    gain = 1.0, -- default
    +    loop = true,
    +}
     -- Play in a location
     {
    -    pos = {x=1,y=2,z=3},
    +    pos = {x = 1, y = 2, z = 3},
         gain = 1.0, -- default
         max_hear_distance = 32, -- default, uses an euclidean metric
     }
    @@ -730,16 +737,18 @@ from the available ones of the following files:

    object = <an ObjectRef>, gain = 1.0, -- default max_hear_distance = 32, -- default, uses an euclidean metric - loop = true, -- only sounds connected to objects can be looped + loop = true, }
    +

    Looped sounds must either be connected to an object or played locationless to +one player using to_player = name,

    SimpleSoundSpec

    • e.g. ""
    • #e.g. "default_place_node"
    • e.g. {}
    • -
    • #e.g. {name="default_place_node"}
    • -
    • #e.g. {name="default_place_node", gain=1.0}
    • +
    • #e.g. {name = "default_place_node"}
    • +
    • #e.g. {name = "default_place_node", gain = 1.0}

    Registered definitions of stuff

    Anything added using certain minetest.register_* functions get added to @@ -1991,6 +2000,13 @@ pass key press events to formspec!

  • #"nodemeta:<X>,<Y>,<Z>": Any node metadata
  • #"detached:<name>": A detached inventory
  • +

    Player Inventory lists

    +
      +
    • #main: list containing the default inventory
    • +
    • #craft: list containing the craft input
    • +
    • #craftpreview: list containing the craft output
    • +
    • #hand: list containing an override for the empty hand
    • +

    ColorString

    #RGB defines a color in hexadecimal format.

    #RGBA defines a color in hexadecimal format and alpha channel.

    @@ -2319,9 +2335,10 @@ The following functions provide escape sequences:
  • #minetest.register_on_cheat(func(ObjectRef, cheat))
    • Called when a player cheats
    • #cheat: {type=<cheat_type>}, where <cheat_type> is one of:
        -
      • #"moved_too_fast"
      • -
      • #"interacted_too_far"
      • -
      • #"finished_unknown_dig"
      • +
      • #moved_too_fast
      • +
      • #interacted_too_far
      • +
      • #interacted_while_dead
      • +
      • #finished_unknown_dig
      • #dug_unbreakable
      • #dug_too_fast
      @@ -2457,7 +2474,7 @@ and minetest.auth_reload call the authetification handler.

    • #Set node at position (node = {name="foo", param1=0, param2=0})
  • -
  • #minetest.swap_node(pos, node
      +
    • #minetest.swap_node(pos, node)
      • Set node at position, but don't remove metadata
    • @@ -2733,6 +2750,19 @@ and minetest.auth_reload call the authetification handler.

    • can be negative for decreasing
  • +
  • #core.check_single_for_falling(pos)
      +
    • #causes an unsupported group:falling_node node to fall and causes an + unattached group:attached_node node to fall.
    • +
    • does not spread these updates to neighbours.
    • +
    +
  • +
  • #core.check_for_falling(pos)
      +
    • #causes an unsupported group:falling_node node to fall and causes an + unattached group:attached_node node to fall.
    • +
    • spread these updates to neighbours and can cause a cascade + of nodes to fall.
    • +
    +
  • Inventory

    minetest.get_inventory(location): returns an InvRef

    @@ -2743,8 +2773,11 @@ and minetest.auth_reload call the authetification handler.

  • #{type="detached", name="creative"}
  • -
  • #minetest.create_detached_inventory(name, callbacks): returns an InvRef
      +
    • #minetest.create_detached_inventory(name, callbacks, [player_name]): returns an InvRef
      • callbacks: See "Detached inventory callbacks"
      • +
      • player_name: Make detached inventory available to one player exclusively, + by default they will be sent to every player (even if not used). + Note that this parameter is mostly just a workaround and will be removed in future releases.
      • Creates a detached inventory. If it already exists, it is cleared.
    • @@ -2763,6 +2796,15 @@ and minetest.auth_reload call the authetification handler.

    • #formspec: formspec to display
  • +
  • #minetest.close_formspec(playername, formname)
      +
    • #playername: name of player to close formspec
    • +
    • #formname: has to exactly match the one given in show_formspec, or the formspec will + not close.
    • +
    • calling show_formspec(playername, formname, "") is equal to this expression
    • +
    • to close a formspec regardless of the formname, call + minetest.close_formspec(playername, ""). USE THIS ONLY WHEN ABSOLUTELY NECESSARY!
    • +
    +
  • #minetest.formspec_escape(string): returns a string
    • escapes the characters "[", "]", "\", "," and ";", which can not be used in formspecs
    @@ -3101,6 +3143,12 @@ and minetest.auth_reload call the authetification handler.

    Misc.

    • #minetest.get_connected_players(): returns list of ObjectRefs
    • +
    • #minetest.hud_replace_builtin(name, hud_definition)
        +
      • Replaces definition of a builtin hud element
      • +
      • #name: "breath" or "health"
      • +
      • #hud_definition: definition to replace builtin definition
      • +
      +
    • #minetest.hash_node_position({x=,y=,z=}): returns an 48-bit integer
      • Gives a unique hash number for a node position (16+16+16=48bit)
      @@ -3124,7 +3172,7 @@ and minetest.auth_reload call the authetification handler.

  • #minetest.get_content_id(name): returns an integer
      -
    • #Gets the internal content ID of name
    • +
    • #Gets the internal content ID of name
  • #minetest.get_name_from_content_id(content_id): returns a string
      @@ -3196,7 +3244,7 @@ and minetest.auth_reload call the authetification handler.

    • #

      minetest.is_protected(pos, name): returns boolean

        -
      • #Returns true, if player name shouldn't be abled to dig at pos or do other +
      • #Returns true, if player name shouldn't be abled to dig at pos 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.
      • This function should be overridden by protection mods and should be used to @@ -3573,12 +3621,6 @@ Can be gotten via minetest.get_node_timer(pos).

    • #hud_get_hotbar_selected_image: returns texturename
    • -
    • #hud_replace_builtin(name, hud_definition)
        -
      • replace definition of a builtin hud element
      • -
      • #name: "breath" or "health"
      • -
      • #hud_definition: definition to replace builtin definition
      • -
      -
    • #set_sky(bgcolor, type, {texture names})
      • #bgcolor: ColorSpec, defaults to white
      • #Available types:
          @@ -4230,8 +4272,9 @@ minetest.spawn_tree(pos,apple_tree) -- ^ Called sometimes; the string returned is passed to on_activate when -- the entity is re-activated from static state - -- Also you can define arbitrary member variables here - myvariable = whatever, + -- Also you can define arbitrary member variables here (see item definition for + -- more info) + _custom_field = whatever, }
  • ABM (ActiveBlockModifier) definition (register_abm)

    @@ -4303,6 +4346,7 @@ minetest.spawn_tree(pos,apple_tree) actual result to client in a short moment. ]] sound = { + breaks = "default_tool_break", -- tools only place = --[[<SimpleSoundSpec>]], }, @@ -4344,6 +4388,12 @@ minetest.spawn_tree(pos,apple_tree) end ^ The user may be any ObjectRef or nil. ]] + _custom_field = whatever, + --[[ + ^ Add your own custom fields. By convention, all custom field names + should start with `_` to avoid naming collisions with future engine + usage. + ]] }

    Tile definition

    @@ -4700,8 +4750,10 @@ The Biome API is still in an experimental phase and subject to change.

    -- ^ Number of nodes high the decoration is made. -- ^ If height_max is not 0, this is the lower bound of the randomly selected height. height_max = 0, --- ^ Number of nodes the decoration can be at maximum. +-- ^ Number of nodes the decoration can be at maximum. -- ^ If absent, the parameter 'height' is used as a constant. + param2 = 0, +-- ^ Param2 value of placed decoration node. ----- Schematic-type parameters schematic = "foobar.mts", @@ -4833,7 +4885,8 @@ The Biome API is still in an experimental phase and subject to change.

    -- ^ collision_removal: if true then particle is removed when it collides, -- ^ requires collisiondetection = true to have any effect attached = ObjectRef, --- ^ attached: if defined, makes particle positions relative to this object. +-- ^ attached: if defined, particle positions, velocities and accelerations +-- ^ are relative to this object's position and yaw. vertical = false, -- ^ vertical: if true faces player using y axis only texture = "image.png", diff --git a/static/style.scss b/static/style.scss index 950d4fa..c51ce8f 100644 --- a/static/style.scss +++ b/static/style.scss @@ -125,9 +125,9 @@ figure { code { display: inline-block; - padding: 5px 10px 5px 10px; + padding: 3px; margin: 2px; - background: #f0f0f0; + background: #f9f9f9; border: 1px solid #e0e0e0; border-radius: 2px; white-space: pre; @@ -137,6 +137,12 @@ code { vertical-align: middle; } +pre code { + background: #f0f0f0; + padding: 5px 10px; + display: block; +} + .header-link, .anchor { text-decoration: none; color: #bbb; diff --git a/update_lua_api.py b/update_lua_api.py index 661b388..741975b 100644 --- a/update_lua_api.py +++ b/update_lua_api.py @@ -34,7 +34,7 @@ text = unicode(text, "utf-8") print("Pre-generation replacements...") -header = """Minetest Lua Modding API Reference 0.4.14 +header = """Minetest Lua Modding API Reference 0.4.15 =========================================""" text = text.replace(header, "")