Dantevg wrote:Something related: Why do all the channel functions accept flat tables, but the channel.peek() function doesn't?
Because peek doesn't send stuff?
That only means that peek doesn't have any arguments to it, which wasn't the question (albeit it was worded badly);
[wiki]Channel:peek[/wiki] The value of the message can be a boolean, string, number or a LÖVE userdata. It returns nil if there's no message in the queue.
This text is missing the "flat table" part, implying to some, that you can't peek (at) a flat table, if it was put into a channel.
I can't test this atm, but as i wrote before, logically, this should be a documentation issue.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
I know the usage of the channel functions. I had already tried it, of course, because it seems so unlogical. When I try to receive a flat table with channel:peek(), it just doesn't receive it. It really doesn't work.
AFAICT the only thing that happened with the wiki was that those redundant descriptions for the Variants were removed from the Channel methods, so... yeah. Idk, s-ol showed a working example for peek; for pop, you need to assign the returned value to something, if you want to use it, it's not like love.graphics.pop that just modifies some internal state; the confusion may have come from that.
In other words, you don't even need to use peek, if you just want to get a value from a channel, use pop.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Yes I know that channel:peek() is just channel:pop() but without changing the queue. But I want to make sure I don't receive any messages from myself. Or is that already taken care of by LÖVE? I thought channel:pop() did modify some internal state, the queue.