ladders.js
/**
	 * Gets the index of a user in the ladder array.
	 *
	 * If createIfNeeded is true, the user will be created and added to
	 * the ladder array if it doesn't already exist.
	 */
Gets the index of a user in the ladder array.
If createIfNeeded is true, the user will be created and added to
the ladder array if it doesn't already exist.
Gets the index of a user in the ladder array . If createIfNeeded is true the user will be created and added to the ladder array if it doesn ' t already exist .
indexOfUser(username, createIfNeeded) {
		let userid = toId(username);
		for (let i = 0; i < this.loadedLadder.length; i++) {
			if (this.loadedLadder[i][0] === userid) return i;
		}
		if (createIfNeeded) {
			let index = this.loadedLadder.length;
			this.loadedLadder.push([userid, 1000, username, 0, 0, 0]);
			return index;
		}
		return -1;
	}
indexOfUser ( username , createIfNeeded ) { let userid = toId ( username ) ; for ( let i = 0 ; i < this . loadedLadder . length ; i ++ ) { if ( this . loadedLadder [ i ] [ 0 ] === userid ) return i ; } if ( createIfNeeded ) { let index = this . loadedLadder . length ; this . loadedLadder . push ( [ userid , 1000 , username , 0 , 0 , 0 ] ) ; return index ; } return - 1 ; }
Gets the index of a user in the ladder array.
Gets the index of a user in the ladder array .