sys.registry.delete(root, key, [value])

Remove a key and all it's assosciated values, or just a value, from the Windows registry.

Parameters

root

Indicates the predefined entry point in the Windows registry, from which the key/value will be accessed. Must be one of the following string :

  • "HKEY_CLASSES_ROOT" : types (or classes) of documents and the properties associated with those types
  • "HKEY_CURRENT_CONFIG" : information about the current hardware
  • "HKEY_CURRENT_USER" : preferences of the current user
  • "HKEY_LOCAL_MACHINE" : data about the computer, system memory, and installed hardware and software

key

Indicates the name of the key to be deleted, or the path to the value to be deleted (the value must be provided as a third parameter).

[value]

Indicates the specific value to be deleted, removes all values for the key if omitted

Return value

This function returns true if the value has been removed from the registry, or otherwise false (See sys.error to get the error message).

Example

local removed = sys.registry.delete("HKEY_CURRENT_USER", "Environment", "value") if removed then print("Removed registry key") else print("Failed to remove key") end