Make sure that coordinates passed to /teleport are actual numbers
authorPilzAdam <pilzadam@minetest.net>
Mon, 8 Jul 2013 11:30:55 +0000 (13:30 +0200)
committerPilzAdam <pilzadam@minetest.net>
Mon, 8 Jul 2013 11:33:14 +0000 (13:33 +0200)
builtin/chatcommands.lua

index 6a3b29e7c83004b88fddf4d15387edd718a28f7a..7d1c2b62a89672df0b582ff184b18bb74f4caa16 100644 (file)
@@ -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