Channel:pop

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
waitnumberfalseHow long to wait for the message to be popped. 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