aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPilzAdam <pilzadam@minetest.net>2013-07-08 13:30:55 +0200
committerPilzAdam <pilzadam@minetest.net>2013-07-08 13:33:14 +0200
commit0b5f18754ccff955562076f3ca9a2a2b129e8487 (patch)
treeeb0f30f13b5c8791d21f432c088ec6563b6902f3
parenta75afb85ca6338da847172bbed3cc776d3aced20 (diff)
downloadminetest-0b5f18754ccff955562076f3ca9a2a2b129e8487.tar.gz
minetest-0b5f18754ccff955562076f3ca9a2a2b129e8487.tar.bz2
minetest-0b5f18754ccff955562076f3ca9a2a2b129e8487.zip
Make sure that coordinates passed to /teleport are actual numbers
-rw-r--r--builtin/chatcommands.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/chatcommands.lua b/builtin/chatcommands.lua
index 6a3b29e7c..7d1c2b62a 100644
--- a/builtin/chatcommands.lua
+++ b/builtin/chatcommands.lua
@@ -272,6 +272,9 @@ minetest.register_chatcommand("teleport", {
local teleportee = nil
local p = {}
p.x, p.y, p.z = string.match(param, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
+ p.x = tonumber(p.x)
+ p.y = tonumber(p.y)
+ p.z = tonumber(p.z)
teleportee = minetest.get_player_by_name(name)
if teleportee and p.x and p.y and p.z then
minetest.chat_send_player(name, "Teleporting to ("..p.x..", "..p.y..", "..p.z..")")
@@ -302,6 +305,9 @@ minetest.register_chatcommand("teleport", {
local p = {}
local teleportee_name = nil
teleportee_name, p.x, p.y, p.z = string.match(param, "^([^ ]+) +([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
+ p.x = tonumber(p.x)
+ p.y = tonumber(p.y)
+ p.z = tonumber(p.z)
if teleportee_name then
teleportee = minetest.get_player_by_name(teleportee_name)
end