var row = rows[i], playerId = row.playerId;
player[playerId] = {

              name : row.name,
       email : row.email,
       money : row.money

};

or even a constructor function are better. read the links the others posted 
first. :)

Am Samstag, 27. April 2013 12:52:58 UTC+2 schrieb Dimitri Bouriez:
>
> Hi all,
>
> I'm working on a multiplayer game where each player's informations is 
> stored in an array of objects indexed by the id of the players. All 
> treatments are done on the players by functions.
>
> That is to create an object with player informations and functions will 
> degrade performance ? I have nearly a thousand players connected 
> simultaneously, whereby the features to be created 1000 times. Or store the 
> information in an array is the fastest way with functions outside ?
>
> Here's how I build the array of players (in a loop):
>
> var playerId = rows[i].playerId;
> player[playerId] = {};
> player[playerId].name = rows[i].name;
> player[playerId].email = rows[i].email;
> player[playerId].money = rows[i].money;
>
>
>
> I know that the fastest way to iterate through the array of objects is a 
> way to do like this:
>
> for(var i = 1, len = player.length; i < len; i++) {
> console.log(player[i]);
> }
>
>  
> Thank you, and sorry for my poor English, i'm french.
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to