Explorar o código

Lua : better ordering of reflect checks for Boot._string_rec

Justin Donaldson %!s(int64=10) %!d(string=hai) anos
pai
achega
ed3cabb736
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      std/lua/Boot.hx

+ 4 - 4
std/lua/Boot.hx

@@ -195,13 +195,13 @@ class Boot {
 			case "table": {
 				var mt : Dynamic = untyped Lua.getmetatable(o);
 				var isArray = mt != null && mt.__index == untyped Array.prototype;
-				if (s.length > 5) isArray ? "[...]" : "{...}";
-				else if (isArray) '[${[for (i in cast(o,Array<Dynamic>)) __string_rec(i,s+"o")].join(", ")}]'
+			    if (Reflect.hasField(o,"__enum__")) printEnum(o);
+				else if (Lua.next(o) == null) "{}";
+				else if (s.length > 5) isArray ? "[...]" : "{...}";
+				else if (isArray) '[${[for (i in cast(o,Array<Dynamic>)) __string_rec(i,s+"o")].join(",")}]'
 				else if (Reflect.hasField(o,"toString")) o.toString();
 				else if (Reflect.hasField(o,"__tostring")) Lua.tostring(o);
-				else if (Reflect.hasField(o,"__enum__")) printEnum(o);
 				else if (Reflect.hasField(o,"__class__")) printClass(o,s);
-				else if (Lua.next(o) == null) "{}";
 				else {
 					cast(o, Table<Dynamic,Dynamic>).pairsFold(function(a,b,c){
 						if (c != "{") c+= ", ";