You are reading a single comment by @ChristianW and its replies. Click here to read the full conversation.
  • Executing dump() logs the current interpreter state to the console.

    Is there a way to get the same output in a variable?

    I can do this for a single function via toString():

    >function foo() {
    :  var bar = 123;
    :  return bar;
    :}
    =function () { ... }
    =undefined
    >var code = foo.toString();
    ="function () {\n  v" ... ";\n  return bar;\n}"
    =undefined
    >console.log( code );
    function () {
      var bar = 123;
      return bar;
    }
    =undefined
    

    How can I do the same with the whole interpreter state?

    PS: Warning - this is the perfect foundation for writing the first puck.js worm - which I intend to do ;-)
    PS2: ...not for harming anyone, but for neatly spreading code through the puck.js field of mine...

About

Avatar for ChristianW @ChristianW started