function Command.Parse(m,o)local U=false for y,V in ipairs(m.ArgumentDefinitions)do if type(V)=="\102\117\110\099\116\105\111\110"then V=V(m)if V==nil then break end end local G=V.Default==nil and V.Optional~=true if G and U then error(("\067\111\109\109\097\110\100 \037\113\058 \082\101\113\117\105\114\101\100 \097\114\103\117\109\101\110\116\115 \099\097\110\110\111\116 \111\099\099\117\114 \097\102\116\101\114 \111\112\116\105\111\110\097\108 \097\114\103\117\109\101\110\116\115\046"):format(m.Name))elseif not G then U=true end if m.RawArguments[y]==nil and(G and o~=true)then return false,("\082\101\113\117\105\114\101\100 \097\114\103\117\109\101\110\116 \035\037\100 \037\115 \105\115 \109\105\115\115\105\110\103\046"):format(y,V.Name)elseif m.RawArguments[y]or o then m.Arguments[y]=Argument.new(m,V,m.RawArguments[y]or"")end end return true end
--- Parses all of the command arguments into ArgumentContexts
-- Called by the command dispatcher automatically
-- allowIncompleteArguments: if true, will not throw an error for missing arguments
function Command:Parse(allowIncompleteArguments)
	local hadOptional = false
	for i, definition in ipairs(self.ArgumentDefinitions) do
		if type(definition) == "function" then
			definition = definition(self)

			if definition == nil then
				break
			end
		end

		local required = (definition.Default == nil and definition.Optional ~= true)

		if required and hadOptional then
			error(("Command %q: Required arguments cannot occur after optional arguments."):format(self.Name))
		elseif not required then
			hadOptional = true
		end

		if self.RawArguments[i] == nil and required and allowIncompleteArguments ~= true then
			return false, ("Required argument #%d %s is missing."):format(i, definition.Name)
		elseif self.RawArguments[i] or allowIncompleteArguments then
			self.Arguments[i] = Argument.new(self, definition, self.RawArguments[i] or "")
		end
	end

	return true
end
