From 6b4f51797093163aea1b231577a449c3e8984a6a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 12 Nov 2016 16:27:07 +0000 Subject: [PATCH] Update lua_api.html --- lua_api.html | 219 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 149 insertions(+), 70 deletions(-) diff --git a/lua_api.html b/lua_api.html index fded574..6bd2696 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 29/August/2016.
See doc/lua_api.txt for the latest version (in plaintext).
Generated using a Python script.
+This page was last updated 12/November/2016.
See doc/lua_api.txt for the latest version (in plaintext).
Generated using a Python script.

Table of Contents

Bans

    @@ -3064,7 +3124,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
      @@ -3100,7 +3160,7 @@ and minetest.auth_reload call the authetification handler.

    • #minetest.deserialize(string): returns a table
      • #Convert a string returned by minetest.deserialize into a table
      • -
      • #string is loaded in an empty sandbox environment.
      • +
      • #string is loaded in an empty sandbox environment.
      • Will load functions, but they cannot access the global environment.
      • #Example: deserialize('return { ["foo"] = "bar" }'), returns {foo='bar'}
      • #Example: deserialize('print("foo")'), returns nil (function call fails)
          @@ -3136,7 +3196,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 @@ -3184,18 +3244,22 @@ end
        • -
        • # -

          minetest.forceload_block(pos)

          +
        • # +

          minetest.forceload_block(pos[, transient])

          • #forceloads the position pos.
          • #returns true if area could be forceloaded
          • -
          • Please note that forceloaded areas are saved when the server restarts.
          • +
          • #If transient is false or absent, the forceload will be persistent + (saved between server runs). If true, the forceload will be transient + (not saved between server runs).
        • -
        • # -

          minetest.forceload_free_block(pos)

          +
        • # +

          minetest.forceload_free_block(pos[, transient])

          • #stops forceloading the position pos
          • +
          • #If transient is false or absent, frees a persistent forceload. + If true, frees a transient forceload.
        • # @@ -3511,7 +3575,7 @@ 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"
          • +
          • #name: "breath" or "health"
          • #hud_definition: definition to replace builtin definition
        • @@ -3592,7 +3656,8 @@ chosen for you.

          Methods

          • #get_area(id, include_borders, include_data): returns the area with the id id. - (optional) Boolean values include_borders and include_data control what's copied.
          • + (optional) Boolean values include_borders and include_data control what's copied. + Returns nil if specified area id does not exist.
          • #get_areas_for_pos(pos, include_borders, include_data): returns all areas that contain the position pos. (optional) Boolean values include_borders and include_data control what's copied.
          • @@ -3633,13 +3698,11 @@ an itemstring, a table or nil.

            • #is_empty(): Returns true if stack is empty.
            • #get_name(): Returns item name (e.g. "default:stone").
            • -
            • #set_name(item_name): Returns boolean success. - Clears item on failure.
            • +
            • #set_name(item_name): Returns boolean whether item was cleared
            • #get_count(): Returns number of items on the stack.
            • -
            • #set_count(count)
            • +
            • #set_count(count): Returns boolean whether item was cleared
            • #get_wear(): Returns tool wear (0-65535), 0 for non-tools.
            • -
            • #set_wear(wear): Returns boolean success. - Clears item on failure.
            • +
            • #set_wear(wear): Returns boolean whether item was cleared
            • #get_metadata(): Returns metadata (a string attached to an item stack).
            • #set_metadata(metadata): Returns true.
            • #clear(): removes all items from the stack, making it empty.
            • @@ -3914,7 +3977,11 @@ will place the schematic inside of the VoxelManip.

            • #expects lighting data in the same format that get_light_data() returns
            -
          • #get_param2_data(): Gets the raw param2 data read into the VoxelManip object
          • +
          • #get_param2_data([buffer]): Gets the raw param2 data read into the VoxelManip object
              +
            • #Returns an array (indices 1 to volume) of integers ranging from 0 to 255
            • +
            • #If the param buffer is present, this table will be used to store the result instead
            • +
            +
          • #set_param2_data(param2_data): Sets the param2 contents of each node in the VoxelManip
          • #calc_lighting([p1, p2], [propagate_shadow]): Calculate lighting within the VoxelManip
            • #To be used only by a VoxelManip object from minetest.get_mapgen_object
            • @@ -4013,14 +4080,16 @@ numeric unique decoration ID.

              Registered entities

              • #Functions receive a "luaentity" as self:
                  -
                • #It has the member .name, which is the registered name ("mod:thing")
                • +
                • #It has the member .name, which is the registered name ("mod:thing")
                • #It has the member .object, which is an ObjectRef pointing to the object
                • The original prototype stuff is visible directly via a metatable
              • -
              • #Callbacks:
                  -
                • #on_activate(self, staticdata)
                    +
                  • #Callbacks:
                      +
                    • #on_activate(self, staticdata, dtime_s)
                      • Called when the object is instantiated.
                      • +
                      • #dtime_s is the time passed since the object was unloaded, which can + be used for updating the entity state.
                    • #on_step(self, dtime)
                        @@ -4029,7 +4098,7 @@ numeric unique decoration ID.

                        in minetest.conf.
                    • -
                    • #on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir
                        +
                      • #on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
                        • Called when somebody punches the object.
                        • Note that you probably want to handle most punches using the automatic armor group system.
                        • @@ -4155,7 +4224,7 @@ minetest.spawn_tree(pos,apple_tree) on_activate = function(self, staticdata, dtime_s), on_step = function(self, dtime), - on_punch = function(self, hitter), + on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir), on_rightclick = function(self, clicker), get_staticdata = function(self), -- ^ Called sometimes; the string returned is passed to on_activate when @@ -4240,15 +4309,18 @@ minetest.spawn_tree(pos,apple_tree) on_place = func(itemstack, placer, pointed_thing), --[[ ^ Shall place item and return the leftover itemstack + ^ The placer may be any ObjectRef or nil. ^ default: minetest.item_place ]] on_secondary_use = func(itemstack, user, pointed_thing), --[[ ^ Same as on_place but called when pointing at nothing. + ^ The user may be any ObjectRef or nil. ^ pointed_thing : always { type = "nothing" } ]] on_drop = func(itemstack, dropper, pos), --[[ ^ Shall drop item and return the leftover itemstack + ^ The dropper may be any ObjectRef or nil. ^ default: minetest.item_drop ]] on_use = func(itemstack, user, pointed_thing), --[[ @@ -4257,6 +4329,7 @@ minetest.spawn_tree(pos,apple_tree) inventory, or an itemstack to replace the original itemstack. e.g. itemstack:take_item(); return itemstack ^ Otherwise, the function is free to do what it wants. + ^ The user may be any ObjectRef or nil. ^ The default functions handle regular use cases. ]] after_use = func(itemstack, user, node, digparams), @@ -4269,6 +4342,7 @@ minetest.spawn_tree(pos,apple_tree) itemstack:add_wear(digparams.wear) return itemstack end + ^ The user may be any ObjectRef or nil. ]] } @@ -4337,7 +4411,10 @@ minetest.spawn_tree(pos,apple_tree) ^ Don't forget to use "leveled" type nodebox. ]] liquid_range = 8, -- number of flowing nodes around source (max. 8) drowning = 0, -- Player will take this amount of damage if no bubbles are left - light_source = 0, -- Amount of light emitted by node + light_source = 0, --[[ + ^ Amount of light emitted by node. + ^ To set the maximum (currently 14), use the value 'minetest.LIGHT_MAX'. + ^ A value outside the range 0 to minetest.LIGHT_MAX causes undefined behavior.]] damage_per_second = 0, -- If player is inside node, this damage is caused node_box = {type="regular"}, -- See "Node boxes" connects_to = nodenames, --[[ @@ -4582,7 +4659,7 @@ The Biome API is still in an experimental phase and subject to change.

                          {
                               deco_type = "simple", -- See "Decoration types"
                               place_on = "default:dirt_with_grass",
                          ---  ^ Node that decoration can be placed on
                          +--  ^ Node (or list of nodes) that the decoration can be placed on
                               sidelen = 8,
                           --  ^ Size of divisions made in the chunk being generated.
                           --  ^ If the chunk size is not evenly divisible by sidelen, sidelen is made equal to the chunk size.
                          @@ -4601,6 +4678,13 @@ The Biome API is still in an experimental phase and subject to change.

                          -- ^ Minimum and maximum `y` positions these decorations can be generated at. -- ^ This parameter refers to the `y` position of the decoration base, so -- the actual maximum height would be `height_max + size.Y`. + spawn_by = "default:water", +-- ^ Node (or list of nodes) that the decoration only spawns next to. +-- ^ Checks two horizontal planes of neighbouring nodes (including diagonal neighbours), +-- ^ one plane at Y = surface and one plane at Y = surface = + 1. + num_spawn_by = 1, +-- ^ Number of spawn_by nodes that must be surrounding the decoration position to occur. +-- ^ If absent or -1, decorations occur next to any nodes. flags = "liquid_surface, force_placement", -- ^ Flags for all decoration types. -- ^ "liquid_surface": Instead of placement on the highest solid surface @@ -4618,13 +4702,6 @@ The Biome API is still in an experimental phase and subject to change.

                          height_max = 0, -- ^ Number of nodes the decoration can be at maximum. -- ^ If absent, the parameter 'height' is used as a constant. - spawn_by = "default:water", --- ^ Node that the decoration only spawns next to. --- ^ The neighbours checked are the 8 nodes horizontally surrounding the lowest node of the --- ^ decoration, and the 8 nodes horizontally surrounding the ground node below the decoration. - num_spawn_by = 1, --- ^ Number of spawn_by nodes that must be surrounding the decoration position to occur. --- ^ If absent or -1, decorations occur next to any nodes. ----- Schematic-type parameters schematic = "foobar.mts", @@ -4755,6 +4832,8 @@ The Biome API is still in an experimental phase and subject to change.

                          collision_removal = false, -- ^ 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. vertical = false, -- ^ vertical: if true faces player using y axis only texture = "image.png",