Property has default: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
Created page with "<onlyinclude>{{{{{format|Function2}}} |name=property_has_default |function1.return_type=boolean |function1.description=Checks if a property has a built-in default value. |func..."
 
mNo edit summary
 
Line 6: Line 6:
|function1.param1.type=string
|function1.param1.type=string
|function1.param1.description=Property name
|function1.param1.description=Property name
|description=All properties in <code>defaults.txt</code> have a default value.
|description=All properties in <code>data/defaults.txt</code> have a default value.


<p>This function was added in [https://kolmafia.us/threads/17892-add-a-bunch-of-ash-support-for-doing-interesting-things-with-properties-bool.21586/ r17892].</p>
<p>This function was added in [https://kolmafia.us/threads/17892-add-a-bunch-of-ash-support-for-doing-interesting-things-with-properties-bool.21586/ r17892].</p>

Latest revision as of 10:44, 23 December 2020

Function Syntax

boolean property_has_defaultstring name )

Checks if a property has a built-in default value.
  • name: Property name

All properties in data/defaults.txt have a default value.

This function was added in r17892.

Code Samples

Check if a property named autoBuyPriceLimit has a default value, and if so, print it.

if ( property_has_default( "autoBuyPriceLimit" ) )
{
   print( property_default_value( "autoBuyPriceLimit" ) );
}

See Also

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