Browse Source

Lua : fix up NativeIterator so that it is callable

Justin Donaldson 9 năm trước cách đây
mục cha
commit
9f19ae1ab7
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      std/lua/NativeIterator.hx

+ 4 - 3
std/lua/NativeIterator.hx

@@ -28,9 +28,10 @@ package lua;
 	Haxe iterators, which provide a next/hasNext interface.
 **/
 
-abstract NativeIterator<T>(HaxeIterator<T>) {
+@:callable
+abstract NativeIterator<T>(Void->T) {
 	public function new(f : Void->T) {
-		this = new HaxeIterator(f);
+		this = f; 
 	}
 
 	@:from
@@ -40,7 +41,7 @@ abstract NativeIterator<T>(HaxeIterator<T>) {
 
 	@:to
 	public function toF() : Iterator<T> {
-		return this;
+		return new HaxeIterator(this);
 	}
 }