So i have a admin commands script im making as of right now. As said in the title would i be able to make a command in the admin have a space if i used the function:

local ScanForArgs = function(Text)

	if Text then
		if Text:sub(1, PreFix:len()) == PreFix and #Text == 1 then
			warn("No Command Stated")   
			return
		elseif Text:sub(1, PreFix:len()) == PreFix and #Text > 1 then
			Text = Text:sub(PreFix:len() + 1, #Text)
			local Command, Arguments = nil, {}
			for v in Text:gmatch("[%w%p]+") do
				if Command == nil then
					Command = v
				else
					table.insert(Arguments, v)
				end
			end
			if Arguments and Command then
				return Command, Arguments
			end
		end
	end
end

and say i wanted to make a command called "ultra crash"? Thanks any help is appreciated!

4 comments

0

I fixed the indentation.

0

In what?

0

If you're talking about making it so the script itself can get values before and after a space, you can try using a method like Text:find(" ") and it'll return where it found the space, then you can just set up a substring to get the values before and after the space. I had to do this about a week ago when I was setting up a customized admin script.

0

Ok i'll try it thanks