gamecircle.Whispersync.GetLowNumberList

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

概览

SyncableNumberList 的形式返回最低值列表

语法

local syncNumList = gamecircle.Whispersync.GetLowNumberList(key, NT_constant)
key (必需)

String. 用于访问特定最低值的密钥。

NT_constant (必需)

String. NT_constant,可以是“INT”或“DOUBLE”,它确定最低值如何存储。“INT”截断小数点值。“DOUBLE”不改变小数点值。如果提供的字符串无效,将默认使用“INT”。

示例

local lowListKey = "myFirstLowNumberList" 
local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, false, true)  
gamecircle.Whispersync.SetLowNumberListLength(lowListKey, 4)  
gamecircle.Whispersync.AddToLowNumberList(lowListKey, 10, "INT")  
gamecircle.Whispersync.AddToLowNumberList(lowListKey, 1000, "INT")  
gamecircle.Whispersync.AddToLowNumberList(lowListKey, 1, "INT")  
gamecircle.Whispersync.AddToLowNumberList(lowListKey, 10000, "INT")   
gamecircle.Whispersync.AddToLowNumberList(lowListKey, 100, "INT")  
print("Here is the list of numbers as they are stored in the low number list. They should be in the order from lowest to  highest.")  
local lowList = gamecircle.Whispersync.GetLowNumberList(lowListKey)  
for i,entry in ipairs(lowList) do  
    print("-" entry.value)  
end  
local keys = gamecircle.Whispersync.GetLowNumberListKeys()  
for i,key in ipairs(keys) do  
    print("-" .. key)  
end