Type function Library gamecircle.* Return value None Revision Release 2022.3683 Keywords leaderboard, scores, get
Use this function to fetch the scores from the leaderboard identified by the provided GameCircle ID.
gamecircle.Leaderboard.GetScores( id, LF_constant, callback )
String. The GameCircle ID of the leaderboard.
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 scores have been fetched. The callback will recieve a single parameter of type GetScoresReturn
local leaderboardId = "myFirstLeaderboard" local gamecircle = require("plugin.gamecircle") gamecircle.Init(false, true, false) function LeaderboardCallback(returnValue) if returnValue.isError == true then print("Get Scores request returned with error message: " .. returnValue.errorMessage) else print("Score information recieved for Leaderboard!") print("-Leaderboard ID" .. returnValue.id) print("-name" .. returnValue.name) print("-displayText" .. returnValue.displayText) print("-num" .. returnValue.num) print("-scoreFormat" .. returnValue.scoreFormat) print("-scores:") for i, score in ipairs(returnValue) do print("--Rank " .. score.rank) print("---" .. score.scoreString .. " by " .. score.player.alias) end end end gamecircle.Leaderboard.GetScores(leaderboardId, "GLOBAL_WEEK", LeaderboardCallback)