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 )
String. The GameCircle ID of the leaderboard we want percentile statistics of.
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”.
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) else print("Percentile information returned for leaderboard " .. returnValue.leaderboard.name) 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) end end end gamecircle.Leaderboard.GetPercentileRanks(leaderboardId, "GLOBAL_WEEK", LeaderboardCallback)