Channel:peek
EditReturns a message from the Channel without popping it from the queue. If the Channel is empty, nil
is returned. This can be useful to determine if the Channel is empty.
message, present = Channel:peek()
Arguments
None
Returns
Name | Type | Description |
message | * |
The message, or nil if there is no message.
|
present | boolean | Whether a message was returned (use to detect nil). |
Notes
The second return value can be used to detect if a nil
message is in the queue.