Browse Source

[lua] Add missing FileHandle.lines() function (#10974)

This allows to iterate over all available lines of a file handle, e.g.
```haxe
final fh = lua.Io.popen(cmd);
if (fh != null) {
  for (line in p.lines()) {
    trace(line);
  }
}
```
Sebastian Thomschke 2 years ago
parent
commit
8d4485be8a
1 changed files with 1 additions and 0 deletions
  1. 1 0
      std/lua/FileHandle.hx

+ 1 - 0
std/lua/FileHandle.hx

@@ -29,6 +29,7 @@ import sys.io.FileInput;
 extern class FileHandle extends UserData {
 extern class FileHandle extends UserData {
 	function flush():Void;
 	function flush():Void;
 	function read(arg:Rest<EitherType<String, Int>>):String;
 	function read(arg:Rest<EitherType<String, Int>>):String;
+	function lines():NativeIterator<String>;
 	function close():Void;
 	function close():Void;
 
 
 	function write(str:String):Void;
 	function write(str:String):Void;