Type Function Return value none Revision 2017.3060 Keywords iCloud, sync, storage, document, docWrite See also iCloud.docRead() iCloudDocEvent iCloud.*
Writes data to a specified file and invokes the onComplete
listener function with an iCloudDocEvent upon completion.
iCloud.docWrite( params )
Table. Table containing
Valid keys for the params
table include:
filename
— Required; name of the file to be used to store data.
contents
— Required; data to be stored in the file.
onComplete
— Required listener function to be invoked with an iCloudDocEvent.
containerId
— Optional string value indicating a specific iCloud Container to be used for document storage. Do not pass this parameter if you have only one iCloud Container associated with your app.
local function docListener( event ) if event.isError then print( event.error ) print( event.errorCode ) end end iCloud.docWrite( { filename = "test.txt", contents = "Corona", onComplete = docListener } )