I tried doing it this way:
Code: Select all
if(Channel:getCount() > 0)then
Channel:pop()
end
Channel:push(value)
LOVE2D's wiki documentation makes it very confusing as to if there are multiple messages, or if a channel can only have one message present at a time. If there actually is a queue, where there are multiple messages waiting to be pop'ed, why is there no method to fetch messages out-of-order in the queue (like if I wanted the second message from the queue)? Honestly, I can see this go both ways--a channel having only one message at a time, and a channel having a queue.