assurance-tunnel
assurance-tunnel
assurance-tunnel
assurance-tunnel

Save text with line breaks



  • Maybe someone finds this useful.

    I managed to save larger lines of text in the data array actor, even with line brakes.

    I wrote a very small java script, changing line breaks to some unusual symbols. A second script recovers the breaks from the recalled data.

    This is the 'encryption':

    function main()
    {
    var text = arguments[0];
    var txt = text.replace(/(?:\r\n|\r|\n)/g, '"->"');
    return txt;
    }

    And this the decryption:

    function main()
    {
    var text = arguments[0];
    var txt = text.replace(/"->"/g, '\r\n');
    return txt;
    }

    .

    PS: Writing this lines, it comes to my mind again, that it would be great to have a <code> function for the forum to visually separate java and shader scripts.


  • Tech Staff

    @dillthekraut

    Clever solution. I like it.


  • Tech Staff

    @dillthekraut

    You do have a <code> function for the forum.