steamworks.getAchievementNames()

类型 函数
返回值 数组
修订版本 版本 2024.3703
关键词 steam, steamworks, 成就, getAchievementNames
另请参阅 steamworks.getAchievementInfo()
steamworks.*

概述

获取为应用程序配置的所有成就的唯一名称,并将其作为数组(包含字符串)返回。在 Steamworks 网站上,这些是在“API 名称进度统计”列下列出的唯一成就名称。API 名称进度统计列。

注意事项

在以下情况下,此函数将返回一个空数组:

语法

steamworks.getAchievementNames()

示例

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