await
Wait for a Promise-like value inside an async function.
Syntax
Section titled “Syntax”T x = await expr;Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
expr | any | Promise (:expect()) or already-resolved value. |
Return value
Section titled “Return value”The resolved value.
Luau emit
Section titled “Luau emit”__await(expr)
Description
Section titled “Description”Not JS await in the event loop sense beyond what Luau Promises provide. Use spawn to run a block without blocking the caller.
Example
Section titled “Example”Data data = await DataService.Server.WaitFor(player);Emits:
local data: Data = __await(DataService.Server:WaitFor(player))