function Command.Parse(l,K)local c=false for F,e in ipairs(l.ArgumentDefinitions)do if type(e)=="\102\117\110\099\116\105\111\110"then e=e(l)if e==nil then break end end local w=e.Default==nil and e.Optional~=true if w and c 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(l.Name))elseif not w then c=true end if l.RawArguments[F]==nil and(w and K~=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(F,e.Name)elseif l.RawArguments[F]or K then l.Arguments[F]=Argument.new(l,e,l.RawArguments[F]or"")end end return true end

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
