Struct DefaultValue

A UDA for explicitly specifying the default value of a Property.

struct DefaultValue(Expression...) ;

This UDA works with getter/setter functions. It should be attached to only one of the two functions.

The normal D default value will still be used if no @DefaultValue UDA is attached.

Example

class S : GodotScript!Node
{
	// UDA is needed to give getter/setter functions a default value
	@Property @DefaultValue!5
	int number() const
	{
		// ...
	}
	void number(int val)
	{
		// ...
	}

	// plain variable; no UDA is needed
	@Property int simpler = 6;
}