leaderboardInfo

Type Event
Revision Current Public Release (2018.3326)
Keywords steam, steamworks, leaderboard, leaderboardInfo
See also steamworks.requestLeaderboardInfo()
steamworks.*

Overview

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

This event can only be received by a function listener that has been passed to the steamworks.requestLeaderboardInfo() function.

Properties

Example

local steamworks = require( "plugin.steamworks" )

-- Called by the "steamworks.requestLeaderboardInfo()" function with the result
local function onReceivedLeaderboardInfo( event )
    if ( event.isError ) then
        -- Request failed; typically happens when there is no Internet access
        print( "Failed to fetch leaderboard info." )
    else
        -- 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 )
    end
end

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