system.deletePreferences()

Type Function
Library system.*
Return value Boolean
Revision Release 2024.3703
Keywords system preference, deletePreferences
See also system.getPreference()
system.setPreferences()

Overview

Deletes preferences from storage.

Returns true if all of the given preferences were successfully deleted and no longer exist in storage. If a requested preference did not already exist in storage, it's still regarded as successfully deleted.

Returns false if at least one of the given preferences failed to be deleted from storage.

Gotchas

Syntax

system.deletePreferences( category, preferenceNames )
category (required)

String. Indicates which set of preferences should be accessed on the system. Currently, only the "app" category is supported — this is the application's custom preferences defined by the Corona app developer.

preferenceNames (required)

Array. An array of strings indicating unique preference names to be deleted from storage.

Example

-- Write this app's custom preferences to storage
local appPreferences =
{
    myBoolean = true,
    myNumber = 123.45,
    myString = "Hello World"
}
system.setPreferences( "app", appPreferences )

-- Sometime later, delete the preferences that were written to storage
system.deletePreferences( "app", { "myBoolean", "myNumber", "myString" } )