gamecircle.Whispersync.GetLowestNumber

类型 函数
gamecircle.*
返回值 可同步数值 (SyncableNumber)
版本 版本 2024.3703
关键词 最小值, 可同步数值, Whispersync

概述

返回分配给键值的最小数值。

语法

local syncNum = gamecircle.Whispersync.GetLowestNumber(key, NT_constant)
(必填)

字符串. 用于访问特定最小值的键。

NT_常量 (必填)

字符串. NT_常量,值为 “INT” 或 “DOUBLE”,决定了最小值的存储方式。“INT” 会截断小数部分。“DOUBLE” 会保留完整的小数部分。如果给定的字符串无效,则默认使用 “INT”。

示例

local lowNumKey = "myFirstLowNumber" 
local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, false, true)  
gamecircle.Whispersync.SetLowestNumber(lowNumKey, 10, "INT")  
gamecircle.Whispersync.SetLowestNumber(lowNumKey, 1000, "INT")  
gamecircle.Whispersync.SetLowestNumber(lowNumKey, 1, "INT")  
gamecircle.Whispersync.SetLowestNumber(lowNumKey, 10000, "INT")  
gamecircle.Whispersync.SetLowestNumber(lowNumKey, 100, "INT")  
print("The Lowest Number is: " .. gamecircle.Whispersync.GetLowestNumber(lowNumKey, "INT").value)  
print("These are all the Lowest Number values stored under the current GameData set of Whispersync.")  
local keys = gamecircle.Whispersync.GetLowestNumberKeys()  
for i,key in ipairs(keys) do  
    print("-" .. key)  
end