gamecircle.Whispersync.GetHighNumberList

类型 函数
gamecircle.*
返回值 SyncableNumber
修订版 2024.3703 版
关键词 最高,SyncableNumber,Whispersync

概述

SyncableNumberList 形式返回最高数列表

语法

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

String. 用于访问特定最高数的键。

NT_constant (必需的)

String. NT_constant,即 “INT” 或 “DOUBLE”,确定最高数的存储方式。 “INT” 切断小数。 “DOUBLE” 保留小数完好无损。如果给定的字符串无效,则默认使用 “INT”。

示例

local highListKey = "myFirstHighNumberList" 
local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, false, true)  
gamecircle.Whispersync.SetHighNumberListLength(highListKey, 4)  
gamecircle.Whispersync.AddToHighNumberList(highListKey, 10, "INT")  
gamecircle.Whispersync.AddToHighNumberList(highListKey, 1000, "INT")  
gamecircle.Whispersync.AddToHighNumberList(highListKey, 1, "INT")  
gamecircle.Whispersync.AddToHighNumberList(highListKey, 10000, "INT")   
gamecircle.Whispersync.AddToHighNumberList(highListKey, 100, "INT")  
print("Here is the list of numbers as they are stored in the high number list. They should be in the order from highest to lowest.")  
local highList = gamecircle.Whispersync.GetHighNumberList(highListKey)  
for i,entry in ipairs(highList) do  
    print("-" entry.value)  
end  
local keys = gamecircle.Whispersync.GetHighNumberListKeys()  
for i,key in ipairs(keys) do  
    print("-" .. key)  
end