Hello there! I’m working on my own admin command panel, and I’m trying to make kick and ban commands with reasons, however, my script separates every single word and puts them into a table, and then runs the commands with the arguments inside the table, what I’m trying to do is to not separate words that are inside of quotation marks, like this:
Message: :kick Player1 "I would like to ask you to get out of the game."
Table: {':kick', 'Player1', '"I would like to ask you to get out of the game."'}
Here’s the part of the script that separates the words:
local cmd = string.split(msg, " ")
local cmd1 = cmd[1]
local arg1 = cmd[2]
local arg2 = cmd[3]
--// Runs command
if cmds[cmd1] then
cmds[cmd1](arg1, arg2)
else
warn("This command does not exist.")
end
It works perfectly fine for things that don’t use whole words, only arguments. Can someone help me with this? Thanks!