mirror of
https://github.com/minetest/minetest.git
synced 2024-09-12 00:26:50 +02:00
Document minetest.parse_relative_number (#12576)
This commit is contained in:
parent
310b12b5ed
commit
9acf2d3db7
@ -6282,6 +6282,20 @@ Misc.
|
|||||||
* Replaces definition of a builtin hud element
|
* Replaces definition of a builtin hud element
|
||||||
* `name`: `"breath"` or `"health"`
|
* `name`: `"breath"` or `"health"`
|
||||||
* `hud_definition`: definition to replace builtin definition
|
* `hud_definition`: definition to replace builtin definition
|
||||||
|
* `minetest.parse_relative_number(arg, relative_to)`: returns number or nil
|
||||||
|
* Helper function for chat commands.
|
||||||
|
* For parsing an optionally relative number of a chat command
|
||||||
|
parameter, using the chat command tilde notation.
|
||||||
|
* `arg`: String snippet containing the number; possible values:
|
||||||
|
* `"<number>"`: return as number
|
||||||
|
* `"~<number>"`: return `relative_to + <number>`
|
||||||
|
* `"~"`: return `relative_to`
|
||||||
|
* Anything else will return `nil`
|
||||||
|
* `relative_to`: Number to which the `arg` number might be relative to
|
||||||
|
* Examples:
|
||||||
|
* `minetest.parse_relative_number("5", 10)` returns 5
|
||||||
|
* `minetest.parse_relative_number("~5", 10)` returns 15
|
||||||
|
* `minetest.parse_relative_number("~", 10)` returns 10
|
||||||
* `minetest.send_join_message(player_name)`
|
* `minetest.send_join_message(player_name)`
|
||||||
* This function can be overridden by mods to change the join message.
|
* This function can be overridden by mods to change the join message.
|
||||||
* `minetest.send_leave_message(player_name, timed_out)`
|
* `minetest.send_leave_message(player_name, timed_out)`
|
||||||
|
Loading…
Reference in New Issue
Block a user