|
@@ -193,16 +193,20 @@ class Boot {
|
|
|
case "function": "<function>";
|
|
|
case "thread" : "<thread>";
|
|
|
case "table": {
|
|
|
- var isArray = untyped Lua.getmetatable(o).__index == Array.prototype;
|
|
|
+ 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(", ")}]'
|
|
|
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 {
|
|
|
- throw "Unknown Lua type";
|
|
|
- null;
|
|
|
+ cast(o, Table<Dynamic,Dynamic>).pairsFold(function(a,b,c){
|
|
|
+ if (c != "{") c+= ", ";
|
|
|
+ return c + __string_rec(a,s + 'o') + ': ' + __string_rec(b, s + 'o');
|
|
|
+ },"{") + "}";
|
|
|
}
|
|
|
};
|
|
|
default : {
|