类型 函数 库 gamecircle.* 返回值 可同步数值 (SyncableNumber) 版本 版本 2024.3703 关键词 最新, 可同步数值, Whispersync
返回分配给键值的最新数值。
local syncNum = gamecircle.Whispersync.GetLatestNumber(key, NT_constant)
字符串. 用于访问特定最新数值的键。
字符串. NT_常量,可以是 “INT” 或 “DOUBLE”,决定了最新数值的存储方式。“INT” 会截断小数部分。“DOUBLE” 会保留完整的小数部分。如果给定的字符串无效,则默认使用 “INT”。
local latestNumKey = "myFirstLatestNumber" local gamecircle = require("plugin.gamecircle") gamecircle.Init(false, false, true) gamecircle.Whispersync.SetLatestNumber(latestNumKey, 10, "INT") gamecircle.Whispersync.SetLatestNumber(latestNumKey, 1000, "INT") gamecircle.Whispersync.SetLatestNumber(latestNumKey, 1, "INT") gamecircle.Whispersync.SetLatestNumber(latestNumKey, 10000, "INT") gamecircle.Whispersync.SetLatestNumber(latestNumKey, 100, "INT") print("The Latest Number is: " .. gamecircle.Whispersync.GetLatestNumber(latestNumKey, "INT").value) print("These are all the Latest Number values stored under the current GameData set of Whispersync.") local keys = gamecircle.Whispersync.GetLatestNumberKeys() for i,key in ipairs(keys) do print("-" .. key) end