gamecircle.Whispersync.SetLatestStringListLength

类型 函数
gamecircle.*
返回的值
修订版 版本 2024.3703
关键字 最近的,列表,SyncableStringList,长度,Whispersync

概述

设置 LatestString 列表的最大长度。此长度受 Amazon GameCircle SDK 的限制,上限为 1000。默认长度为 5。

语法

gamecircle.Whispersync.SetLatestStringListLength(key, value)
gamecircle.Whispersync.SetLatestStringListLength(key, value)
key (必需)

字符串. 用于访问特定最新数字的密钥。

value (必需)

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

示例

local latestListKey = "myFirstLatestStringList"  
local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, false, true)  
gamecircle.Whispersync.SetLatestStringListLength(latestListKey, 4)  
gamecircle.Whispersync.AddToLatestStringList(latestListKey, "A")
gamecircle.Whispersync.AddToLatestStringList(latestListKey, "B")
gamecircle.Whispersync.AddToLatestStringList(latestListKey, "C")
gamecircle.Whispersync.AddToLatestStringList(latestListKey, "D") 
gamecircle.Whispersync.AddToLatestStringList(latestListKey, "E") 
print("Here is the list of numbers as they are stored in the latest number list. They should be in the order from latest to oldest.")  
local latestList = gamecircle.Whispersync.GetLatestStringList(latestListKey)  
for i,entry in ipairs(latestList) do  
    print("-" entry.value)  
end  
local keys = gamecircle.Whispersync.GetLatestStringListKeys()  
for i,key in ipairs(keys) do  
    print("-" .. key)  
end