Type Function Return value AchievementInfo Revision 2018.3332 Keywords steam, steamworks, achievements, getAchievementInfo See also steamworks.requestUserProgress() steamworks.setAchievementUnlocked() steamworks.*
Returns an AchievementInfo object. This provides information about one achievement such as its localized name, description, unlock status, etc. for the currently logged in user (or another user).
This function will return
nil in the following cases:
false, indicating the application is not currently connected to the Steam client.
steamworks.getAchievementInfo( achievementName [, userSteamId] )
String. On the Steamworks website, this is the unique name of the achievement set under the
String. The unique string ID of the user. The ID will default to the current user if this argument is not provided.
local steamworks = require( "plugin.steamworks" ) -- Called when achievement status or stat data has been updated/changed -- This will be called for the currently logged in user, and other users too local function onUserProgressUpdated( event ) -- Determine who this progress update is for if ( event.userSteamId == steamworks.userSteamId ) then print( "Received progress info for current user." ) else print( "Received progress info for another user." ) end -- Print the user's current achievement info local achievementInfo = steamworks.getAchievementInfo( "MyAchievementName", event.userSteamId ) if ( achievementInfo ) then print( " Localized Name: " .. achievementInfo.localizedName ) print( " Localized Description: " .. achievementInfo.localizedDescription ) print( " Is Hidden: " .. tostring(achievementInfo.hidden) ) print( " Was Unlocked: " .. tostring(achievementInfo.unlocked) ) if ( achievementInfo.unlocked ) then -- Note that "unlockTime" is in local Unix time -- This can be compared with "os.time()" and used by "os.date()" print( " Unlock Time: " .. os.date( "%c", achievementInfo.unlockTime ) ) end end end -- Listen for achievement status or stat data changes from all users steamworks.addEventListener( "userProgressUpdate", onUserProgressUpdated )