await
Updatedawait expr
Yields until the Future settles, then returns its values or rethrows its error. Accepts a Future or any value with andThen; the std spells the operand's type Awaitable<T>, which is Future<T>.
await yields the running thread, so it needs a thread the runtime owns: the body of an async function, an async do ... end block, an after block, the top level of a *.server.aly or *.client.aly script, which Roblox runs on a thread of its own, or a function written in the call to task.spawn, task.defer, task.delay, or a signal's Connect or Once, which each start the function on a new thread. Anywhere else it reports. A module's top level yields inside require; a plain function yields into whatever called it, and a caller that is C code, such as a table.sort comparator, kills the thread on Roblox. A function boundary resets this: an ordinary function inside an async function is not an async context, though an async function expression is.
try await f() turns a rejection into an Err and follows the same rule. When f is an async function declared to return a Result, the Result it settles with is the value, not an Ok around it.
The word is also free as a name. await before an operand on the same line is the operator; await(p), await = f, and await.field read the Luau way, so a local named await is a local.
