Namespace: Steamworks

Lua
C++
Edit

GetLeaderboardEntries

This function retrieves the leaderboard scores.

Syntax

Parameter Description
id Leaderboard ID
request can be LEADERBOARD_GLOBAL, LEADERBOARD_AROUNDUSER, or LEADERBOARD_FRIENDS
start starting index
count number of entries

Returns

Returns an array of LeaderboardEntry objects, each with the following members:

Property Type Description
userid uint64 user ID of the player for this entry
score int user's score

Remarks

See the Steamworks documentation for more information about Steam leaderboards.

Example

#include "UltraEngine.h"
#include "Steamworks/Steamworks.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    // Initialize Steam
    if (not Steamworks::Initialize())
    {
        RuntimeError("Steamworks failed to initialize.");
        return 1;
    }

    auto leaderboard = Steamworks::GetLeaderboard("Feet Traveled");
    Print("Leaderboard: " + String(leaderboard));

    auto entries = Steamworks::GetLeaderboardEntries(leaderboard);
    for (int n = 0; n < entries.size(); ++n)
    {
        auto name = Steamworks::GetUserName(entries[n].userid);
        Print(name + ": " + String(entries[n].score));        
    }

    auto s = Input("\nEnter your score:");
    Steamworks::SetLeaderboardScore(leaderboard, s.ToInt());

    Steamworks::Shutdown();
    return 0;
}
Copyright © 2006-2025 Leadwerks Software.
All rights reserved.
Leadwerks 4 Documentation