diff --git a/src/module/io.wren b/src/module/io.wren index afe161f4..c008df4b 100644 --- a/src/module/io.wren +++ b/src/module/io.wren @@ -224,8 +224,9 @@ class Stdin { static readByte() { return read_ { // Peel off the first byte. + // TODO: this doing a huge amount of effort, but likely fast enough var byte = __buffered.bytes[0] - __buffered = __buffered[1..-1] + __buffered = __buffered.bytes.skip(1).map { |x| String.fromByte(x) }.join() return byte } } diff --git a/src/module/io.wren.inc b/src/module/io.wren.inc index 22b27355..8c7a7350 100644 --- a/src/module/io.wren.inc +++ b/src/module/io.wren.inc @@ -228,8 +228,9 @@ static const char* ioModuleSource = " static readByte() {\n" " return read_ {\n" " // Peel off the first byte.\n" +" // TODO: this doing a huge amount of effort, but likely fast enough\n" " var byte = __buffered.bytes[0]\n" -" __buffered = __buffered[1..-1]\n" +" __buffered = __buffered.bytes.skip(1).map { |x| String.fromByte(x) }.join() \n" " return byte\n" " }\n" " }\n"