Core Function EnumList

From Sputnik Wiki
Jump to: navigation, search
EnumList( <expression> )

Contents

Description

Return an array of all user defined enums (Or just ones fitting a given pattern).

expression

Optional; Text to find contained in the enum names or a regex to match against the enum names.

Return Value

Success: Returns an array of the found enums.

Failure: Returns an empty array.

Remarks

None.

Example

// Define a few user enums
Enum moo { $VALUE };
Enum cat { $VALUE };
Enum dog { $VALUE };
Enum fox9 { $VALUE };
 
// All enums
foreach(EnumList() as $c)
{
	println("F: " . $c);
}
println("Loop complete\n");
 
// All enums that contain "at"
foreach(EnumList("at") as $c)
{
	println("F: " . $c);
}
println("Loop complete\n");
 
// All enums that match the regex pattern \w+\d
foreach(EnumList(m/\w+\d/) as $c)
{
	println("F: " . $c);
}
println("Loop complete\n");
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox