NativeSignal: Wait Asynchronous
Wait for the next firing of a runtime-backed event. Use it to await one event’s arguments in the current coroutine. It observes the next event, so waiting after a one-time event has already occurred can leave the coroutine waiting indefinitely.
Luau
NativeSignal:Wait() -> ...anyParameters
Call this method with a NativeSignal receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.
This function takes no arguments.
Returns
...anyThe event’s arguments as multiple return values. Their types depend on the event.
Example
Luau
-- Requires a server that sends a message after a client connects.
local socket = WebSocket.connect("ws://127.0.0.1:8765")
-- This waits indefinitely if no future message arrives.
local message = socket.OnMessage:Wait()
print("Received:", message)
socket:Close()