Skip to content

Commit 0013f06

Browse files
Desoursfan5
authored andcommittedSep 1, 2019
Various fixes to lua_api.txt (#8878)
1 parent 095f26a commit 0013f06

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed
 

Diff for: ‎doc/lua_api.txt

+15-8
Original file line numberDiff line numberDiff line change
@@ -4079,8 +4079,7 @@ Call these functions only at load time!
40794079
allow for multiple protection mods.
40804080
* `minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing))`
40814081
* Called when an item is eaten, by `minetest.item_eat`
4082-
* Return `true` or `itemstack` to cancel the default item eat response
4083-
(i.e.: hp increase).
4082+
* Return `itemstack` to cancel the default item eat response (i.e.: hp increase).
40844083
* `minetest.register_on_priv_grant(function(name, granter, priv))`
40854084
* Called when `granter` grants the priv `priv` to `name`.
40864085
* Note that the callback will be called twice if it's done by a player,
@@ -5400,7 +5399,11 @@ This is basically a reference to a C++ `ServerActiveObject`
54005399

54015400
* `get_pos()`: returns `{x=num, y=num, z=num}`
54025401
* `set_pos(pos)`: `pos`=`{x=num, y=num, z=num}`
5403-
* `move_to(pos, continuous=false)`: interpolated move
5402+
* `move_to(pos, continuous=false)`
5403+
* Does an interpolated move for Lua entities for visually smooth transitions.
5404+
* If `continuous` is true, the Lua entity will not be moved to the current
5405+
position before starting the interpolated move.
5406+
* For players this does the same as `set_pos`,`continuous` is ignored.
54045407
* `punch(puncher, time_from_last_punch, tool_capabilities, direction)`
54055408
* `puncher` = another `ObjectRef`,
54065409
* `time_from_last_punch` = time since last punch action of the puncher
@@ -5409,7 +5412,7 @@ This is basically a reference to a C++ `ServerActiveObject`
54095412
* `get_hp()`: returns number of hitpoints (2 * number of hearts)
54105413
* `set_hp(hp, reason)`: set number of hitpoints (2 * number of hearts).
54115414
* See reason in register_on_player_hpchange
5412-
* `get_inventory()`: returns an `InvRef`
5415+
* `get_inventory()`: returns an `InvRef` for players, otherwise returns `nil`
54135416
* `get_wield_list()`: returns the name of the inventory list the wielded item
54145417
is in.
54155418
* `get_wield_index()`: returns the index of the wielded item
@@ -6058,6 +6061,10 @@ LBM (LoadingBlockModifier) definition
60586061

60596062
Used by `minetest.register_lbm`.
60606063

6064+
A loading block modifier (LBM) is used to define a function that is called for
6065+
specific nodes (defined by `nodenames`) when a mapblock which contains such nodes
6066+
gets loaded.
6067+
60616068
{
60626069
label = "Upgrade legacy doors",
60636070
-- Descriptive label for profiling purposes (optional).
@@ -6072,8 +6079,8 @@ Used by `minetest.register_lbm`.
60726079

60736080
run_at_every_load = false,
60746081
-- Whether to run the LBM's action every time a block gets loaded,
6075-
-- and not just for blocks that were saved last time before LBMs were
6076-
-- introduced to the world.
6082+
-- and not only the first time the block gets loaded after the LBM
6083+
-- was introduced.
60776084

60786085
action = function(pos, node),
60796086
}
@@ -6516,10 +6523,10 @@ Used by `minetest.register_node`.
65166523
-- default: nil
65176524

65186525
can_dig = function(pos, [player]),
6519-
6520-
on_punch = function(pos, node, puncher, pointed_thing),
65216526
-- Returns true if node can be dug, or false if not.
65226527
-- default: nil
6528+
6529+
on_punch = function(pos, node, puncher, pointed_thing),
65236530
-- default: minetest.node_punch
65246531
-- By default calls minetest.register_on_punchnode callbacks.
65256532

0 commit comments

Comments
 (0)
Please sign in to comment.