Set a member from an existing enumerator type as default member. The default member is also selected when a instance of a Type is created using the enumerator as a required property.
mod_enum(enum, 'def', name)
Argument | Type | Description |
---|---|---|
enum | str | Name of the enumerator type where the member has to be removed from. |
'def' |
str | Passing this argument will result in a set default action. |
name | str | Name of the member to set as default. |
The value nil
.
This code shows how to use the action def:
set_enum('Color', {
RED: '#f00',
GREEN: '#0f0',
BLUE: '#00f'
});
// set GREEN as the default color
mod_enum('Color', 'def', 'GREEN');
enum('Color').name(); // color now defaults to GREEN
Return value in JSON format
"GREEN"