rename_property

From Kolmafia
Revision as of 10:52, 23 December 2020 by Philmasterplus (talk | contribs) (Created page with "<onlyinclude>{{{{{format|Function2}}} |name=rename_property |function1.return_type=boolean |function1.description=Renames a property. Returns <code>true</code> on success, <co...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

boolean rename_propertystring old_name )

Renames a property. Returns true on success, false on failure.
  • old_name: Old property name

To rename a property, the following conditions must be met:

  • Both old_name and new_name must not be a built-in property.
  • old_name must exist.
  • new_name must not exist.

This function was added in r17892.

Code Samples

Rename a property named myOldPref to myNewPref.

if ( !rename_property( "myOldPref", "myNewPref" ) )
{
   abort( "Failed to rename property" );
}

See Also

get_all_properties() | property_exists() | property_has_default() | property_default_value() | get_property() | set_property() | remove_property() | rename_property()