auto [a, b] =
Unpack multiple return values. The usual pairing with pcall.
Syntax
Section titled “Syntax”auto [a, b] = expr;Parameters
Section titled “Parameters”None.
Return value
Section titled “Return value”Each name is a local.
Luau emit
Section titled “Luau emit”local a, b = expr
Description
Section titled “Description”Not structured bindings for structs. Not auto [x, y] on a table field unpack unless expr returns multiple values.
Example
Section titled “Example”auto [success, result] = pcall(func () { return DataStore.GetAsync("PlayerData");});Emits:
local success, result = pcall(function() return DataStore:GetAsync("PlayerData")end)