We use cookies on this site to enhance your user experience

Jul 03 2018, 10:57 AM PST 2 min

A tuple is an ordered list of elements.

In Roblox Lua, the Tuple type refers to a list of Lua variables. If a Articles/Method|method accepts a Tuple as an argument, then that means it accepts multiple values. If a method returns a Tuple, then that means it returns multiple values.

As an example, the Workspace/FindPartOnRay|FindPartOnRay returns a Tuple. More specifically, it returns a Part and a DataType/Vector3|Vector3.

local part, position = Workspace:FindPartOnRay(ray)

The BindableFunction/Invoke|Invoke method in BindableFunction accepts a Tuple as an argument. So, it can accept multiple arguments.

BindableFunction:Invoke(1, true, "string", Vector3.new(0,0,0) )

Tuples as Variadic arguments

When specified as the last argument to a function, Tuples sometimes represent variadic arguments. Depending on the context of the function, this might mean that the function accepts any number of arguments of the specified types. One example of this is the ContextActionService’s ContextActionService/BindAction|BindAction method.

See also