diff --git a/examples/prettyDebug.js b/examples/prettyDebug.js index 27b2b333..ae2a3288 100644 --- a/examples/prettyDebug.js +++ b/examples/prettyDebug.js @@ -6,6 +6,7 @@ const pretty = { even: { nested: "objects", }, + arrays: ["show", "like", "you", "would", "write", "them"], "own toString is used": vec2(10, 10) } diff --git a/src/gfx/draw/drawDebug.ts b/src/gfx/draw/drawDebug.ts index bf5bb258..3c509ea9 100644 --- a/src/gfx/draw/drawDebug.ts +++ b/src/gfx/draw/drawDebug.ts @@ -220,12 +220,20 @@ export function drawDebug() { } function prettyDebug(object: any | undefined, inside: boolean = false): string { + var outStr = "", tmp; if (inside && typeof object === "string") { object = JSON.stringify(object); } + if (Array.isArray(object)) { + outStr = [ + "[", + object.map(e => prettyDebug(e, true)).join(", "), + "]" + ].join(""); + object = outStr; + } if (typeof object === "object" && object.toString === Object.prototype.toString) { - var outStr = "", tmp; if (object.constructor !== Object) outStr += object.constructor.name + " "; outStr += [ "{",