function Argument.Transform(j)if#j.TransformedValues~=0 then return end local Z=j.RawValue if j.Type.ArgumentOperatorAliases then Z=j.Type.ArgumentOperatorAliases[Z]or Z end if Z=="\046"and j.Type.Default then Z=j.Type.Default(j.Executor)or""j.RawSegmentsAreAutocomplete=true end if Z=="\063"and j.Type.Autocomplete then local h,n=j:GetDefaultAutocomplete()if not n.IsPartial and#h>0 then Z=h[math.random(1,#h)]j.RawSegmentsAreAutocomplete=true end end if j.Type.Listable and#j.RawValue>0 then local h=Z:match("\094\037\063\040\037\100\043\041\036")if h then local n=tonumber(h)if n and n>0 then local h={}local W,S=j:GetDefaultAutocomplete()if not S.IsPartial and#W>0 then for j=1,math.min(n,#W),1 do table.insert(h,table.remove(W,math.random(1,#W)))end Z=table.concat(h,"\044")j.RawSegmentsAreAutocomplete=true end end elseif Z=="\042"or Z=="\042\042"then local h,n=j:GetDefaultAutocomplete()if not n.IsPartial and#h>0 then if Z=="\042\042"and j.Type.Default then local Z=j.Type.Default(j.Executor)or""for j,n in ipairs(h)do if n==Z then table.remove(h,j)end end end Z=table.concat(h,"\044")j.RawSegmentsAreAutocomplete=true end end Z=unescapeOperators(Z)local n=Util.SplitStringSimple(Z,"\044")if#n==0 then n={""}end if Z:sub(#Z,#Z)=="\044"then n[#n+1]=""end for Z,h in ipairs(n)do j.RawSegments[Z]=h j.TransformedValues[Z]={j:TransformSegment(h)}end j.TextSegmentInProgress=n[#n]else Z=unescapeOperators(Z)j.RawSegments[1]=unescapeOperators(Z)j.TransformedValues[1]={j:TransformSegment(Z)}j.TextSegmentInProgress=j.RawValue end end function Argument.TransformSegment(Z,j)if Z.Type.Transform then return Z.Type.Transform(j,Z.Executor)else return j end end
--- Calls the transform function on this argument.
-- The return value(s) from this function are passed to all of the other argument methods.
-- Called automatically at instantiation
function Argument:Transform()
	if #self.TransformedValues ~= 0 then
		return
	end

	local rawValue = self.RawValue
	if self.Type.ArgumentOperatorAliases then
		rawValue = self.Type.ArgumentOperatorAliases[rawValue] or rawValue
	end

	if rawValue == "." and self.Type.Default then
		rawValue = self.Type.Default(self.Executor) or ""
		self.RawSegmentsAreAutocomplete = true
	end

	if rawValue == "?" and self.Type.Autocomplete then
		local strings, options = self:GetDefaultAutocomplete()

		if not options.IsPartial and #strings > 0 then
			rawValue = strings[math.random(1, #strings)]
			self.RawSegmentsAreAutocomplete = true
		end
	end

	if self.Type.Listable and #self.RawValue > 0 then
		local randomMatch = rawValue:match("^%?(%d+)$")
		if randomMatch then
			local maxSize = tonumber(randomMatch)

			if maxSize and maxSize > 0 then
				local items = {}
				local remainingItems, options = self:GetDefaultAutocomplete()

				if not options.IsPartial and #remainingItems > 0 then
					for _ = 1, math.min(maxSize, #remainingItems) do
						table.insert(items, table.remove(remainingItems, math.random(1, #remainingItems)))
					end

					rawValue = table.concat(items, ",")
					self.RawSegmentsAreAutocomplete = true
				end
			end
		elseif rawValue == "*" or rawValue == "**" then
			local strings, options = self:GetDefaultAutocomplete()

			if not options.IsPartial and #strings > 0 then
				if rawValue == "**" and self.Type.Default then
					local defaultString = self.Type.Default(self.Executor) or ""

					for i, string in ipairs(strings) do
						if string == defaultString then
							table.remove(strings, i)
						end
					end
				end

				rawValue = table.concat(strings, ",")
				self.RawSegmentsAreAutocomplete = true
			end
		end

		rawValue = unescapeOperators(rawValue)

		local rawSegments = Util.SplitStringSimple(rawValue, ",")

		if #rawSegments == 0 then
			rawSegments = { "" }
		end

		if rawValue:sub(#rawValue, #rawValue) == "," then
			rawSegments[#rawSegments + 1] = "" -- makes auto complete tick over right after pressing ,
		end

		for i, rawSegment in ipairs(rawSegments) do
			self.RawSegments[i] = rawSegment
			self.TransformedValues[i] = { self:TransformSegment(rawSegment) }
		end

		self.TextSegmentInProgress = rawSegments[#rawSegments]
	else
		rawValue = unescapeOperators(rawValue)

		self.RawSegments[1] = unescapeOperators(rawValue)
		self.TransformedValues[1] = { self:TransformSegment(rawValue) }
		self.TextSegmentInProgress = self.RawValue
	end
end

function Argument:TransformSegment(rawSegment)
	if self.Type.Transform then
		return self.Type.Transform(rawSegment, self.Executor)
	else
		return rawSegment
	end
end
