Skip to content

Instantly share code, notes, and snippets.

@thejh
Created February 12, 2012 22:29
Show Gist options
  • Save thejh/1811227 to your computer and use it in GitHub Desktop.
Save thejh/1811227 to your computer and use it in GitHub Desktop.
// wrong
two: function(callback){
// See if the player can join anymore rooms
if (playerRooms(user.id) == false || roomExists(data.room) < 1) {
socket.emit('error', "You can't join this table.");
return false;
}
callback(null, 1);
},
// should work
two: function(callback){
// See if the player can join anymore rooms
playerRooms(user.id, function(playerRoomsResult) {
if (playerRoomsResult == false || roomExists(data.room) < 1) {
socket.emit('error', "You can't join this table.");
return false; // this line is still wrong
}
callback(null, 1);
})
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment