Browse Source

[lua] throw eof properly in FileInput

closes #7544
Kevin Leung 7 years ago
parent
commit
91ef180dd7
1 changed files with 5 additions and 0 deletions
  1. 5 0
      std/lua/_std/sys/io/FileInput.hx

+ 5 - 0
std/lua/_std/sys/io/FileInput.hx

@@ -67,6 +67,11 @@ class FileInput extends haxe.io.Input {
 		}
 		return NativeStringTools.byte(byte);
 	}
+			
+	override function readBytes( s : Bytes, pos : Int, len : Int ) : Int {
+		if(eof()) throw new haxe.io.Eof();
+		return super.readBytes(s, pos, len);
+	}
 
 	override inline public function close() : Void {
 		f.close();