Rename property: Difference between revisions
Jump to navigation
Jump to search
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..." |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 6: | Line 6: | ||
|function1.param1.type=string | |function1.param1.type=string | ||
|function1.param1.description=Old property name | |function1.param1.description=Old property name | ||
|function1. | |function1.param2=new_name | ||
|function1. | |function1.param2.type=string | ||
|function1. | |function1.param2.description=New property name | ||
|description=To rename a property, the following conditions must be met: | |description=To rename a property, the following conditions must be met: | ||
Latest revision as of 10:53, 23 December 2020
Function Syntax
boolean rename_property( string old_name, string new_name )
- Renames a property. Returns
true
on success,false
on failure.- old_name: Old property name
- new_name: New 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" );
}