Sorting Array with non string items

I have two questions that are trying to get to the same place

I am creating an array of all modifiers,

modArr = modifier.classes

Is there a way to sort this array into alphabetical order since the items are not strings?

Or is there a way to force "modifier.classes" to return the list in alphabetical order?

Thanks!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

I will love to see if someone have the answer why this not works

fn sortAlphabetical class = 
(
	name = with PrintAllElements on class as string
	name = filterstring stlclass "#(), "
	name = sort name 
	for c in class collect class[(finditem name (c as string))]
)
sortAlphabetical modifier.classes

Anyway this works but we need to use "EXECUTE"

:(

fn sortAlphabetical class = 
(
	name = with PrintAllElements on class as string
	name = filterstring stlclass "#(), "
	name = sort name 
	for m in name collect execute m
)
sortAlphabetical modifier.classes

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.