类型 函数 库 gamecircle.* 返回值 无 修订 版本 2024.3703 关键词 最新,列表,可同步数字列表,Whispersync
将一个值添加到 LatestNumberList。该数字很可能会作为最新条目添加到列表的顶部。然后,如果列表超过其最大长度,则列表中最旧的数字将被删除。
gamecircle.Whispersync.AddToLatestNumberList(key, value, NT_constant) gamecircle.Whispersync.AddToLatestNumberList(key, value, NT_constant, metadata)
字符串。 用于访问特定最新数字的键。
数字。 要分配给最新数字的值。
字符串。 NT_常量,可以是“INT”或“DOUBLE”,决定了最新数字的存储方式。“INT”会截断小数部分。“DOUBLE”会保留完整的小数部分。如果给定的字符串无效,则默认使用“INT”。
元数据。 要与数字一起存储的元数据表。它必须是一个 Lua 表,仅包含字符串字段,并且这些字段的值也必须是字符串。有关示例和更多信息,请查看元数据的文档页面。
local latestListKey = "myFirstLatestNumberList" local gamecircle = require("plugin.gamecircle") gamecircle.Init(false, false, true) gamecircle.Whispersync.SetLatestNumberListLength(latestListKey, 4) gamecircle.Whispersync.AddToLatestNumberList(latestListKey, 10, "INT") gamecircle.Whispersync.AddToLatestNumberList(latestListKey, 1000, "INT") gamecircle.Whispersync.AddToLatestNumberList(latestListKey, 1, "INT") gamecircle.Whispersync.AddToLatestNumberList(latestListKey, 10000, "INT") gamecircle.Whispersync.AddToLatestNumberList(latestListKey, 100, "INT") print("Here is the list of numbers as they are stored in the latest number list. They should be in the order from latest to oldest.") local latestList = gamecircle.Whispersync.GetLatestNumberList(latestListKey) for i,entry in ipairs(latestList) do print("-" entry.value) end local keys = gamecircle.Whispersync.GetLatestNumberListKeys() for i,key in ipairs(keys) do print("-" .. key) end