aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorWuzzy <Wuzzy@disroot.org>2022-05-22 14:28:24 +0000
committerGitHub <noreply@github.com>2022-05-22 10:28:24 -0400
commitac5e8176b9a2b36520bcc78b9d486aea7742d554 (patch)
treedcff272c35d4c62a49d1252ee1ed1a651c09fdbd /doc
parent9f338f5a56e5adee3d11d59827f7e2b8a714e6c2 (diff)
downloadminetest-ac5e8176b9a2b36520bcc78b9d486aea7742d554.tar.gz
minetest-ac5e8176b9a2b36520bcc78b9d486aea7742d554.tar.bz2
minetest-ac5e8176b9a2b36520bcc78b9d486aea7742d554.zip
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>
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 6046a5902..96b1cc469 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -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.