Channel:pop

Edit

Pops a message from the Channel. If the Channel is empty, an optional timeout argument can be used to wait for a message, otherwise nil is returned.

message = Channel:pop(wait)

Arguments

NameTypeDefaultDescription
waitnumberfalse How long to wait for a message to be popped, in seconds. true can be used to wait forever and false can be used to avoid waiting.

Returns

NameTypeDescription
message* The received message, or nil if nothing was received.

Notes

Threads can get stuck forever waiting on Channel messages, so be careful.

See also