gamecircle.Whispersync.SetLatestString

Type function
Library gamecircle.*
Return value None
Revision Release 2024.3703
Keywords Latest, SyncableString, Whispersync

Overview

Set a value to the latest string associated with the key. Only the latest value assigned will be stored.

Syntax

gamecircle.Whispersync.SetLatestString(key, value)
gamecircle.Whispersync.SetLatestString(key, value, metadata)
key (required)

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

value (require)

String. The value to be assigned to the latest string.

metadata (optional)

Metadata. A table of metadata to be stored with the string. It must be a lua table comprised only of string fields with string values in those fields. For examples and more information, check the documentation page for metadata.

Examples

local latestNumKey = "myFirstLatestString"  
local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, false, true)  
gamecircle.Whispersync.SetLatestString(latestNumKey, "A")
gamecircle.Whispersync.SetLatestString(latestNumKey, "B") 
gamecircle.Whispersync.SetLatestString(latestNumKey, "C")
gamecircle.Whispersync.SetLatestString(latestNumKey, "D") 
gamecircle.Whispersync.SetLatestString(latestNumKey, "E") 
print("The Latest String is: " .. gamecircle.Whispersync.GetLatestString(latestNumKey, "INT").value)  
print("These are all the Latest String values stored under the current GameData set of Whispersync.")  
local keys = gamecircle.Whispersync.GetLatestStringKeys()  
for i,key in ipairs(keys) do   
    print("-" .. key)  
end