gamecircle.Whispersync.GetHighestNumber

类型 函数
gamecircle.*
返回值 可同步数字
修订历史 正式版本 2024.3703
关键字 Highest、可同步数字、Whispersync

概述

返回曾经分配给键值的最高数字。

语法

local syncNum = gamecircle.Whispersync.GetHighestNumber(key, NT_constant)
(必需)

字符串. 用于访问特定最高数字的键。

NT_常量 (必需)

字符串. NT_constant,为“INT”或“DOUBLE”,决定如何存储最高数字。“INT”截断小数部分。“DOUBLE”保持小数部分不变。如果给定的字符串无效,“INT”将被用作默认值。

示例

local highNumKey = "myFirstHighNumber" 
local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, false, true)  
gamecircle.Whispersync.SetHighestNumber(highNumKey, 10, "INT")  
gamecircle.Whispersync.SetHighestNumber(highNumKey, 1000, "INT")  
gamecircle.Whispersync.SetHighestNumber(highNumKey, 1, "INT")  
gamecircle.Whispersync.SetHighestNumber(highNumKey, 10000, "INT")  
gamecircle.Whispersync.SetHighestNumber(highNumKey, 100, "INT")  
print("The Highest Number is: " .. gamecircle.Whispersync.GetHighestNumber(highNumKey, "INT").value)  
print("These are all the Highest Number values stored under the current GameData set of Whispersync.")  
local keys = gamecircle.Whispersync.GetHighestNumberKeys()  
for i,key in ipairs(keys) do  
    print("-" .. key)  
end