What does Three dots (...) mean in Lua

What does Three dots ( … ) in lua mean ?, ex;

RemoteEvent.OnServerEvent:Connect(function(arg1, arg2, ...)

i just came across them and i have no clue about what it could be

1 Like

they return the rest of the arguments in a tuple (or table idk forgot)

1 Like

Yeah, it refers to a tuple which comprises the rest of the arguments passed. If you want to turn them into a table:

local packed = {...}
1 Like

An elipses (three consecutive periods) in Lua denotes a variable argument expression, as its name suggests it’s an expression that represents a variable number of arguments.

local function ExampleFunc(FirstArg, SecondArg, ...)
	local VarArg = {...} --Packs the variable arguments into a table.

ExampleFunc(1, 2, 3, 4, 5) --FirstArg is passed '1', SecondArg is passed '2' and the variable argument expression is passed '3, 4 and 5'.

You can learn more here, just bare in mind that the implicit ‘arg’ variable isn’t declared in Roblox Lua, you need to explicitly assign the variable argument expression instead.


You can compare the elipses (…) to *args and **Leary’s in other languages

or you can use table.pack