类型 函数 库 gamecircle.* 返回值 无 修订 版本 2024.3703 关键词 最新, 列表, 可同步字符串列表, Whispersync
将一个值添加到 LatestStringList(最新字符串列表)。最新的字符串很可能会被添加到列表的顶部。然后,如果列表超过其最大长度,则列表中当前最旧的字符串将被删除。
gamecircle.Whispersync.AddToLatestStringList(key, value) gamecircle.Whispersync.AddToLatestStringList(key, value, metadata)
字符串. 用于访问特定最新字符串的键。
字符串. 要分配给最新字符串的值。
元数据. 要与字符串一起存储的元数据表。它必须是一个 Lua 表,仅包含字符串字段,并且这些字段中包含字符串值。有关示例和更多信息,请查看元数据的文档页面。
local latestListKey = "myFirstLatestStringList" local gamecircle = require("plugin.gamecircle") gamecircle.Init(false, false, true) gamecircle.Whispersync.SetLatestStringListLength(latestListKey, 4) gamecircle.Whispersync.AddToLatestStringList(latestListKey, "A") gamecircle.Whispersync.AddToLatestStringList(latestListKey, "B") gamecircle.Whispersync.AddToLatestStringList(latestListKey, "C") gamecircle.Whispersync.AddToLatestStringList(latestListKey, "D") gamecircle.Whispersync.AddToLatestStringList(latestListKey, "E") print("Here is the list of strings as they are stored in the latest string list. They should be in the order from latest to oldest.") local latestList = gamecircle.Whispersync.GetLatestStringList(latestListKey) for i,entry in ipairs(latestList) do print("-" entry.value) end local keys = gamecircle.Whispersync.GetLatestStringListKeys() for i,key in ipairs(keys) do print("-" .. key) end