I was working on an algorithm for an admin commands system, that basically formatted a message into something that can be read by the command runner.
local Prefix = ';'
local BatchKey = '|'
local SplitKey = ' '
function RunMessage(Player, Message)
Message = string.lower(Message)
local Batches = {}
local BatchStarts = {}
if string.sub(Message, 1, 3) == '/e ' then
Message = string.sub(Message, 4)
end
if not string.sub(Message, 1, string.len(Prefix)) == Prefix then
return
else
table.insert(BatchStarts, 1)
end
for Index = string.len(Prefix)+1, string.len(Message) do
if string.sub(Message, Index, Index+string.len(BatchKey)) == BatchKey then
if string.sub(Message, Index+string.len(BatchKey)+1, Index+string.len(BatchKey)+1+string.len(Prefix)) == Prefix then
table.insert(BatchStarts, Index+string.len(BatchKey)+1)
end
end
end
for Index, BatchStart in pairs(BatchStarts) do
local BatchEnd
if string.sub(Message, BatchStart, BatchStart+string.len(Prefix)) then
BatchEnd = BatchStarts[Index+1]
else
BatchEnd = string.len(Message)
end
table.insert(Batches, string.sub(Message, BatchStart, BatchEnd))
end
for Index, Command in pairs(Batches) do
local Arguments = {}
for Argument in string.gmatch(Message, '([^'..SplitKey..']+)') do
table.insert(Arguments, Argument)
end
local CommandName = string.sub(Arguments[1], string.len(Prefix)+1)
table.remove(Arguments, 1)
API:RunCommand(Player, CommandName, Arguments)
end
end

2 comments
What kind of issue are you getting and what errors/warnings come out of the console?
I added a print command in line 40, and it returned the WHOLE message (";fly me|;speed me 100")