From 977ec7558f643bba1c7ef016a641dfdcb8bc466a Mon Sep 17 00:00:00 2001 From: bi Date: Fri, 8 Jun 2018 13:29:49 +0300 Subject: [PATCH] Commands: restricted command name to have only [a-z, A-Z, 0-9, _] chars --- vmf/scripts/mods/vmf/modules/core/commands.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vmf/scripts/mods/vmf/modules/core/commands.lua b/vmf/scripts/mods/vmf/modules/core/commands.lua index e3816c3..14bb63e 100644 --- a/vmf/scripts/mods/vmf/modules/core/commands.lua +++ b/vmf/scripts/mods/vmf/modules/core/commands.lua @@ -22,9 +22,8 @@ VMFMod.command = function (self, command_name, command_description, command_func return end - if string.find(command_name, " ") then - - self:error("(command): command name can't contain spaces: [%s]", command_name) + if string.match(command_name, "[^%w_]") then + self:error("(command) '%s': command name can contain only [a-z, A-Z, 0-9, _] characters", command_name) return end