Type Function Return value none Revision Release 2024.3703 Keywords iCloud, sync, storage, Key-Value Storage, KVS, set See also iCloud.get() iCloud.synchronize() iCloud.*
Associates a value with a key. This
iCloud.set( key, value )
String. The key name to associate with a value. This name can be used with iCloud.get() to retrieve the value.
String, Number, or Table. The value to be associated with the key. Tables must contain named
Storage space for KVS is strictly limited. You can declare a maximum of 1024 keys and the total size of all values should be less than 1 MB. Keys should be less than 64 symbols (bytes).
Setting arrays is not supported, neither as tables by themselves or as contents of other tables. Technically, Lua arrays are tables with numbered indices, but stored tables must contain named
local arr = { true, false, 0, 10 } -- This is analogous to { 1=true, 2=false, 3=0, 4=10 } iCloud.set( "myArray", arr ) -- This will produce an error and the value will not be stored
iCloud.set( "touches", 52 ) iCloud.set( "rose", { kind="flower", color="red", amount=12 } ) iCloud.set( "engine", "Corona" ) local json = require( "json" ) iCloud.set( "data", json.encode( someTable ) )