• Login
sketchucation logo sketchucation
  • Login
🔌 Quick Selection | Try Didier Bur's reworked classic extension that supercharges selections in SketchUp Download

Print Arrays, Hashes etc in a readable format?

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 200 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    thomthom
    last edited by 24 Jan 2009, 19:34

    Is there a way to output an Array, Hash etc in the Console in a more readable way?
    So that items are listed on each their line and indents as the object nests?

    Thomas Thomassen — SketchUp Monkey & Coding addict
    List of my plugins and link to the CookieWare fund

    1 Reply Last reply Reply Quote 0
    • T Offline
      todd burch
      last edited by 24 Jan 2009, 20:01

      myarray.sort.join("\n") from the console works great.

      For hashes, take your pick of .each, each_key, each_pair, and so on.

      Read up on the Enumerable class.

      1 Reply Last reply Reply Quote 0
      • T Offline
        thomthom
        last edited by 24 Jan 2009, 20:22

        Ok. I was just checking that there wasn't a built-in function that printed objects, like what you get in PHP with print_r.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          3/3
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement