Core Function EnumList
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> EnumList( <expression> ) </pre> === Description === Return an array of all user defined enums (Or just ones fitting a given pattern). ==== expression ==== Optional; Tex...") |
m (1 revision) |
Revision as of 21:40, 11 August 2014
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");