Channel:push

Pushes a message onto the Channel. The following types of data can be pushed: nil, boolean, number, string, and userdata. Simple tables can be serialized to JSON using the json module.

id, read = Channel:push(message, wait)

Arguments

NameTypeDefaultDescription
message*The message to push.
waitnumberfalseHow long to wait for the message to be popped, in seconds. true can be used to wait forever and false can be used to avoid waiting.

Returns

NameTypeDescription
idnumberThe ID of the pushed message.
readbooleanWhether the message was read by another thread before the wait timeout.

Notes

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

See also