Is there any way to iterate over class definitions during preinit? Specifically I want to iterate over all Action classes that are subclasses of a specific class. E.g. something like:
I think you can do that with the firstObj() and nextObj() functions. Pass the ObjClasses flag to only iterate over class objects (note that classes are also objects, which is why this works.)
An example of how to iterate over all SystemAction subclasses (excluding the SystemAction class itself):
local classObj = firstObj(SystemAction, ObjClasses);
while (classObj != nil) {
// Do stuff. We just print the object name here.
"<<toString(classObj)>>\n";
classObj = nextObj(classObj, SystemAction, ObjClasses);
}
Edit:
Jim was way faster as I was typing and testing this