gamecircle.Whispersync.GetLatestStringList

类型 函数
gamecircle.*
返回值 SyncableString
修订 版本 2024.3703
关键词 最新, 列表, SyncableStringList, Whispersync

概述

将最新的字符串列表作为 SyncableStringList 返回。

语法

local syncStringList = gamecircle.Whispersync.GetLatestStringList(key, NT_constant)
(必填)

字符串 用于访问特定最新字符串的键。

示例

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 strings as they are stored in the latest string 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