"too much recursion" error "too much recursion" error
0.0 0


I’m building a / p5.js game and I have this strange error when I want to emit from the client to the server:
“too much recursion”

Here is a part of my front-end code which gives the error:

var users = [];
var foods = [];
var data = {};
var socket;

function setup() {
    socket = io.connect('http://localhost:3000');
    createCanvas(windowWidth, windowHeight);
    users[0] = new User();
    for(var i=0; i<5; i++){
        foods.push(new Food());
    data = {users: users, foods: foods};
    socket.emit('start', {say: 'hi'});
    //doesn't work
    socket.emit('start', data);

The code gives the error only when I give it as a 2nd argument an already created object/array… It’s strange. And I don’t know what to do.

The error comes from the cdn on my client.

Anyone has any idea how can I fix this?


I found a fix, for now, by removing the createVector function from user.js and food.js… It’s a built in p5.js function, and now works… Yey!