From: Carl Worth Date: Sun, 10 May 2020 21:21:19 +0000 (-0700) Subject: Rename a variable from "player_string" to "player_data" X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=a89e6229a4c88c77f9a532df8104bceba56b4c40;p=lmno-server Rename a variable from "player_string" to "player_data" The name of "player_string" made me think this is just a string representation of a player's name. But instead, this variable is holding the JSON representation of the data block of a "player-register" event. So a name of "player_data" is much more clear. --- diff --git a/server.js b/server.js index 7bb29e5..ca7b844 100644 --- a/server.js +++ b/server.js @@ -27,8 +27,8 @@ class Game { /* The syntax here is using an anonymous function to create a new object from new_player with just the subset of fields that we want. */ - const player_string = JSON.stringify((({id, name}) => ({id, name}))(new_player)); - this.broadcast_event("player-join", player_string); + const player_data = JSON.stringify((({id, name}) => ({id, name}))(new_player)); + this.broadcast_event("player-join", player_data); } remove_player(id) {