Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Debugging tip

If you are working with javascript objects, the following will dump them out in a nicely formatted way:
<<print JSON.stringify($var, null, 4)>>
doesn't seem to require any extra library imports (at least in 1.4.2 B3).

Comments

  • Good tip!

    You can see all your variables at once with this:

    <<print JSON.stringify(state.history[0].variables, null, 4)>>

    Or for SugarCube:

    <<print JSON.stringify(state.active.variables, null, 4)>>
  • mykael wrote:

    doesn't seem to require any extra library imports (at least in 1.4.2 B3).


    It shouldn't.  The JSON global object (specifically: window.JSON) has been a browser built-in for quite a while now.
  • Twine 1.4 is, in fact, programmed to halt immediately if either window.JSON or document.querySelector are missing from the user's browser.
  • Aargh!! I wish I knew this two months ago!!!

    Still, thanks :D
Sign In or Register to comment.