4 ms·
Point taken, yet this particular problem with players asked one after the other is simpler than the case when players are each spawned their own Ask. Here's a s
by utopkara 13y ago
Point taken, yet this particular problem with players asked one after the other is simpler than the case when players are each spawned their own Ask. Here's a simple solution to your problem:
function getAllNames(players, callback){
function getPlayer(i, players, callback){
Ask("What's your name", function(name){
if(isValidName(name)){
players[i++].name = name;
}
if(i == players.length){
callback(players);
} else {
getPlayer(i, players, callback);
}
});
}
getPlayer(0, players, callback)
}