Browse Source

[lua] use correct syntax for _hx_iterator inline function under dce. Close #5055

Justin Donaldson 9 years ago
parent
commit
de715ff928
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/generators/genlua.ml

+ 1 - 1
src/generators/genlua.ml

@@ -1712,7 +1712,7 @@ let generate com =
 	List.iter (fun (_,_,e) -> chk_features e) ctx.statics;
 	List.iter (fun (_,_,e) -> chk_features e) ctx.statics;
 	if has_feature ctx "use._iterator" then begin
 	if has_feature ctx "use._iterator" then begin
 		add_feature ctx "use._hx_bind";
 		add_feature ctx "use._hx_bind";
-		println ctx "function _hx_iterator(o) { if ( lua.Boot.__instanceof(o, Array) ) return function() { return HxOverrides.iter(o); }; return typeof(o.iterator) == 'function' ? _hx_bind(o,o.iterator) : o.iterator; }";
+		println ctx "function _hx_iterator(o)  if ( lua.Boot.__instanceof(o, Array) ) then return function() return HxOverrides.iter(o) end elseif (typeof(o.iterator) == 'function') then return  _hx_bind(o,o.iterator) else return  o.iterator end end";
 	end;
 	end;
 	if has_feature ctx "use._hx_bind" then println ctx "_hx_bind = lua.Boot.bind";
 	if has_feature ctx "use._hx_bind" then println ctx "_hx_bind = lua.Boot.bind";