Currently I have a leaderboard with 10 players: Players1~10. For sake of simplicity, the player rank corresponds to the player number (Player1 is rank 1, Player10 is rank 10).
I want to grab 5 players around Player5, so that would be Player3~7.
const recordList = nk.leaderboardRecordsList(leagueId, [userId]);
const ownerRecord = recordList.ownerRecords[0];
const cursor = nk.leaderboardRecordsListCursorFromRank(leagueId, ownerRecord.rank);
const haystack = nk.leaderboardRecordsHaystack(leagueId, userId, 5, cursor, 0);
I was hoping to get Players3~7 with this code, but for some reason ownerRecord.rank
is 0, so leaderboardRecordsListCursorFromRank
throws an error.
Am I even conceptually close, or is there a better way to handle this?