mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Add relative numbers for commands by prepending ~ (#9588)
* Add relative numbers for commands by prepending ~ * Some builtin code cleanup * Disallow nan and inf in minetest.string_to_area * Remove unused local variable teleportee (makes Luacheck happy) * Clean up core.string_to_pos * Make area parsing less permissive * Rewrite tests as busted tests * /time: Fix negative minutes not working Co-authored-by: Lars Mueller <appgurulars@gmx.de>
This commit is contained in:
parent
9f338f5a56
commit
ac5e8176b9
4 changed files with 264 additions and 51 deletions
|
@ -3550,8 +3550,16 @@ Helper functions
|
|||
* `minetest.string_to_pos(string)`: returns a position or `nil`
|
||||
* Same but in reverse.
|
||||
* If the string can't be parsed to a position, nothing is returned.
|
||||
* `minetest.string_to_area("(X1, Y1, Z1) (X2, Y2, Z2)")`: returns two positions
|
||||
* `minetest.string_to_area("(X1, Y1, Z1) (X2, Y2, Z2)", relative_to)`:
|
||||
* returns two positions
|
||||
* Converts a string representing an area box into two positions
|
||||
* X1, Y1, ... Z2 are coordinates
|
||||
* `relative_to`: Optional. If set to a position, each coordinate
|
||||
can use the tilde notation for relative positions
|
||||
* Tilde notation: "~": Relative coordinate
|
||||
"~<number>": Relative coordinate plus <number>
|
||||
* Example: `minetest.string_to_area("(1,2,3) (~5,~-5,~)", {x=10,y=10,z=10})`
|
||||
returns `{x=1,y=2,z=3}, {x=15,y=5,z=10}`
|
||||
* `minetest.formspec_escape(string)`: returns a string
|
||||
* escapes the characters "[", "]", "\", "," and ";", which can not be used
|
||||
in formspecs.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue