Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

havent seen this being used often,what does this parameter mean?

1 answer

✓ Accepted answer

So, the three dots are an ellipsis. In functions, they are used as a substitute to having named parameters. For example:

local function foo (...)
	print(#{...})--8
	for _,v in pairs({...}) do
		print(v)
	end
end

foo("thy","they","2",121,343,4323,"fbi","boo")

the ellipsis is particularly useful when you are sending a lot of arguments to a function, and instead of having to create a parameter for every single argument you have. For Example:

game.ReplicatedStorage.Remote.OnServerEvent:Connect(function(...)
	local a = {...} --table of arguments
	print(a[1],a[3],a[2],a[6],a[9])
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.