gamecircle.Whispersync.SetLowestNumber

类型 函数
gamecircle.*
返回值
修订版 发行版 2024.3703
关键词 最低值、可同步数字、Whispersync

概述

将值设为与该键关联的最小数字。只存储曾经分配过的最小值。

语法

gamecircle.Whispersync.SetLowestNumber(key, value, NT_constant)
gamecircle.Whispersync.SetLowestNumber(key, value, NT_constant, metadata)
key (必需)

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

value (必需)

数字. 要分配给最小数字的值。

NT_constant (必需)

字符串. NT_constant 为“INT”或“DOUBLE”,它确定要如何存储最小数字。“INT”将截断小数值。“DOUBLE”将保持小数值完整。如果给定的字符串无效,则默认使用“INT”。

metadata (可选)

元数据. 要与该数字一起存储的元数据表。它必须仅包含字符串字段且该字段中的字符串值是 Lua 表。有关示例和更多信息,请查看元数据的文档页面。

示例

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