1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

custom commands use pcall

This commit is contained in:
grilledham 2018-05-07 13:16:41 +01:00
parent 742c94db04
commit 9b6f8b60cc

View File

@ -458,6 +458,17 @@ local function reactor_toggle()
end
end
end
local old_add_command = commands.add_command
commands.add_command = function(name, desc, func)
old_add_command(name, desc, function(cmd)
local success, error = pcall(func, cmd)
if not suc then
log(err)
end
end)
end
commands.add_command("kill", "Will kill you.", kill)
commands.add_command("tpplayer", "<player> - Teleports you to the player. (Admins and moderators)", teleport_player)
commands.add_command("invoke", "<player> - Teleports the player to you. (Admins and moderators)", invoke)