Type Function
Return value Boolean
Revision 2018.3333
Keywords steam, steamworks, leaderboard, requestLeaderboardInfo
See also steamworks.requestLeaderboardEntries()


Asynchronously fetches information about one leaderboard such as its entry count, display/value type, sort order, etc.

Returns true if the request was successfully sent to Steam. Note that this does not necessarily mean that the requested operation will succeed. For example, this function will return true if there is no Internet connection. So, the listener must check the received event.isError property to determine if the requested operation succeeded.

Returns false if given invalid arguments or if the steamworks.isLoggedOn property is false.


steamworks.requestLeaderboardInfo( params )
params (required)

Table. Table containing parameters — see the next section for details.

Parameter Reference

The params table can contain the following:

leaderboardName (required)

String. The unique name of the leaderboard to fetch information from. On the Steamworks website, this is the leaderboard string set under the Name column.

listener (required)

Function. Function which will receive the result of the request via a leaderboardInfo event.


local steamworks = require( "plugin.steamworks" )

local function onReceivedLeaderboardInfo( event )
    if ( event.isError ) then
        -- The request has failed
        print( "Failed to fetch leaderboard info." )
        -- Print the received leaderboard information to the log
        print( "Leaderboard Name: " .. event.leaderboardName )
        print( "Entry Count: " .. tostring(event.entryCount) )
        print( "Sort Method: " .. event.sortMethod )
        print( "Display Type: " .. event.displayType )

-- Fetch information about one leaderboard
-- Requires an active Internet connection to succeed
-- Provides the requested result to the given "listener" function
local requestSettings =
    leaderboardName = "My Leaderboard Name",
    listener = onReceivedLeaderboardInfo
steamworks.requestLeaderboardInfo( requestSettings )