Type function
Library gamecircle.*
Return value None
Revision Release 2024.3703
Keywords leaderboard, get


Use this function to fetch the percentile statistical information for a leaderboard


gamecircle.Leaderboard.GetPercentileRanks( id, LF_constant, callback )
id (required)

String. The GameCircle ID of the leaderboard we want percentile statistics of.

LF_constant (required)

String. This is the Leaderboard Filter constants and is use to related to the GameCircle SDK's inteneral enumerator. It has four valid values: "GLOBAL_ALL_TIME", "GLOBAL_WEEK", "GLOBAL_DAY", & "FRIENDS_ALL_TIME". If a string is put into this parameter that doesn't match one of these four strings, then the function will default to using "GLOBAL_ALL_TIME".

callback (required)

Function. The callback function for when the percentile statistsc have been fetched. The callback will recieve a single parameter of type PercentileReturn


local leaderboardId = "myFirstLeaderboard"  
local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, true, false)  
function LeaderboardCallback(returnValue)  
     if returnValue.isError == true then  
        print("Get Percentile request returned with error message: " .. returnValue.errorMessage)  
        print("Percentile information returned for leaderboard " ..  
        print("The local user's index in the list is : " .. returnValue.userIndex)  
        print("-(-1 means user is not on leaderboard)")  
        print("Here is the statistical information:")  
        for i,stat in ipairs(returnValue) do  
            print("#" .. i .. " " .. stat.playerAlias .. "-" .. stat.playerScore .. "-" .. percentile)  
gamecircle.Leaderboard.GetPercentileRanks(leaderboardId, "GLOBAL_WEEK", LeaderboardCallback)