gamecircle.Whispersync.GetStringSetValue

Type function
Library gamecircle.*
Return value SyncableStringElement
Revision Release 2024.3703
Keywords Highest, SyncableNumber, Whispersync

Overview

Returns the requested string from the set as a SyncableStringElement. If the string doesn't exist in the set, then the isSet variable of the returned table will be set to "false". Another way to check is the StringSetContains function.

Syntax

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

String. The key used to access a specific string set.

value (required)

String. The value to be fetched from the specific string set.

Examples

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