gamecircle.Whispersync.GetStringSetValue

类型 函数
gamecircle.*
返回值 SyncableStringElement
版本 Release 2024.3703
关键字 Highest,SyncableNumber,Whispersync

概述

返回指定字符串集中的请求字符串,返回 SyncableStringElement。如果字符串并不存在于集中,则返回的表格的 isSet 变量将设置为“false”。另一种检查方式是使用 StringSetContains 函数。

语法

local stringSetElement = gamecircle.Whispersync.GetStringSetValue(key, value)
key (必填)

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

value (必填)

字符串 该值将从指定的字符串集中获取。

示例

local stringSetKey = "myFirstStringSet" 
local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, false, true)  
gamecircle.Whispersync.AddToStringSet("A")
gamecircle.Whispersync.AddToStringSet("B")
gamecircle.Whispersync.AddToStringSet("C")
gamecircle.Whispersync.AddToStringSet("D")
gamecircle.Whispersync.AddToStringSet("E")
print("Does the set contain F?: " .. gamecircle.Whispersync.StringSetContains(stringSetKey, "F"))
print("Here is what the string set does contain:")
local stringSet = gamecircle.Whispersync.GetStringSet(stringSetKey)  
for i,entry in ipairs(stringSet) do  
    print("-" entry.value)  
end  
print("The extra for element A is:")
local entryA = gamecircle.Whispersync.GetStringSetValue("A")
print("-value: " .. entryA.value)
print("-isSet: " .. entryA.isSet)
print("-metadataPresent: " .. entryA.metadataPresent)
print("-timestamp: " .. entryA.timestamp)
local keys = gamecircle.Whispersync.GetHighNumberListKeys()  
for i,key in ipairs(keys) do  
    print("-" .. key)  
end