Skip to content

Commit 0b5f187

Browse files
committedJul 8, 2013
Make sure that coordinates passed to /teleport are actual numbers
1 parent a75afb8 commit 0b5f187

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎builtin/chatcommands.lua

+6
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ minetest.register_chatcommand("teleport", {
272272
local teleportee = nil
273273
local p = {}
274274
p.x, p.y, p.z = string.match(param, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
275+
p.x = tonumber(p.x)
276+
p.y = tonumber(p.y)
277+
p.z = tonumber(p.z)
275278
teleportee = minetest.get_player_by_name(name)
276279
if teleportee and p.x and p.y and p.z then
277280
minetest.chat_send_player(name, "Teleporting to ("..p.x..", "..p.y..", "..p.z..")")
@@ -302,6 +305,9 @@ minetest.register_chatcommand("teleport", {
302305
local p = {}
303306
local teleportee_name = nil
304307
teleportee_name, p.x, p.y, p.z = string.match(param, "^([^ ]+) +([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
308+
p.x = tonumber(p.x)
309+
p.y = tonumber(p.y)
310+
p.z = tonumber(p.z)
305311
if teleportee_name then
306312
teleportee = minetest.get_player_by_name(teleportee_name)
307313
end

0 commit comments

Comments
 (0)
Please sign in to comment.