Browse Source

Lua : better ordering of reflect checks for Boot._string_rec

Justin Donaldson 10 years ago
parent
commit
ed3cabb736
1 changed files with 4 additions and 4 deletions
  1. 4 4
      std/lua/Boot.hx

+ 4 - 4
std/lua/Boot.hx

@@ -195,13 +195,13 @@ class Boot {
 			case "table": {
 			case "table": {
 				var mt : Dynamic = untyped Lua.getmetatable(o);
 				var mt : Dynamic = untyped Lua.getmetatable(o);
 				var isArray = mt != null && mt.__index == untyped Array.prototype;
 				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")) o.toString();
 				else if (Reflect.hasField(o,"__tostring")) Lua.tostring(o);
 				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 (Reflect.hasField(o,"__class__")) printClass(o,s);
-				else if (Lua.next(o) == null) "{}";
 				else {
 				else {
 					cast(o, Table<Dynamic,Dynamic>).pairsFold(function(a,b,c){
 					cast(o, Table<Dynamic,Dynamic>).pairsFold(function(a,b,c){
 						if (c != "{") c+= ", ";
 						if (c != "{") c+= ", ";