p5js - save(); only works in setup();

Hi everyone,

I am trying to save a single string in a .txt file, but the save(); function seems to work only inside the setup(); function. Here is an exemple that doesn't work:
var data; function setup() { Canvas = createCanvas(300, 300); data = "I am a string"; } function saveMe() { save(data, 'myText.txt'); } function mouseClicked() { saveMe(); } function draw() { background(255); }

Any idea?? Thanks!

Answers

Sign In or Register to comment.