steamworks.getAchievementNames()

Type Function
Return value Array
Revision 2018.3381
Keywords steam, steamworks, achievements, getAchievementNames
See also steamworks.getAchievementInfo()
steamworks.*

Overview

Fetches the unique names of all achievements configured for the application and returns it as an array of strings. On the Steamworks website, these are the unique achievement names listed under the API Name Progress Stat column.

Gotchas

This function will return an empty array in the following cases:

Syntax

steamworks.getAchievementNames()

Example

local steamworks = require( "plugin.steamworks" )

-- Print information about all achievements belonging to this application
local achievementNames = steamworks.getAchievementNames()
for index = 1, #achievementNames do
    -- Fetch information about the next achievement
    local achievementName = achievementNames[index]
    local achievementInfo = steamworks.getAchievementInfo( achievementName )

    -- Print the achievement's information/status to the log
    print( "Achievement " .. tostring(index) )
    print( "  Localized Name: " .. achievementInfo.localizedName )
    print( "  Localized Description: " .. achievementInfo.localizedDescription )
    print( "  Is Unlocked: " .. tostring(achievementInfo.unlocked) )
end