Discord
Login
Community
DARK THEME

Problems with sending player objects as connection payload

Why is it, that I can not simply send a class object as payload with connection.send() ? Server is not reading a message

A possible explanation could be that your object is holding references to other objects, which also hold references to other objects and so on. This most often creates circular references (e.g. player has a reference to playground and playground has a list of the players).

To avoid that, I'd recommend to use a dedicated plain object to hold all the values that need to be sent to the server. Like:

player.status = object
  x = 10
  y = 20
  health = 50
  ammo = 15
end

thx

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community