类型 函数 返回值 数组 修订版本 版本 2024.3703 关键词 steam, steamworks, 成就, getAchievementNames 另请参阅 steamworks.getAchievementInfo() steamworks.*
获取为应用程序配置的所有成就的唯一名称,并将其作为数组(包含字符串)返回。在 Steamworks 网站上,这些是在“API 名称进度统计”列下列出的唯一成就名称。
在以下情况下,此函数将返回一个空数组:
false
,表示应用程序当前未连接到 Steam 客户端。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