Tuple

(Redirected from API:Tuple)
< Data Types

A tuple is an ordered list of elements.

In Roblox Lua, the Tuple type refers to a list of Lua variables. If a 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 FindPartOnRay returns a Tuple. More specifically, it returns a Part and a Vector3.

local part, position = Workspace:FindPartOnRay(ray)

The 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[edit]

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 BindAction method.

See also[edit]

External links[edit]