Forums > Gen

WARNING: In genexpr, peek must be assigned to a variable!

Sep 03 2016 | 1:48 pm

I thought I would post in case it helps someone else avoid the frustration i’ve just experienced, as i have not seen it documented anywhere. It seems that when working inside a codebox you cannot just call peek like a method without it being assigned to a variable (the way you can with poke). Maybe this would be something obvious to someone with more coding experience, but it sure wasn’t to me, and the real frustrating part about it is it will just quietly cause your whole gen patch not to compile, with no helpful warning to figure out why. So for example,

if(someBuffer.peek(i)) {

is no good. You must write

token = someBuffer.peek(i);
if(token) {

Viewing 1 post (of 1 total)

Forums > Gen