tdu.ValidName add "Parameter" argument

@Ivan It would be nice if tdu.ValidName coul also get an optional argument to use the function to generate a name that is usable for Parameters.
i.E.

tdu.ValidName( "A_Name", par = True) => "Aname"
1 Like

Ah, I have one in the Comp Editor. Turns out it’s a bit more complicated than that. I’ll put this on my list to expose the functionality though.

If you want a preview to see what it does you can search the CompEditorExt for legalparname. If you just want character checking it’s

		name = name.strip().lower().capitalize()  # fix cases
		name = re.sub('[^A-Za-z0-9]+', '', name)  # remove special chars
		if not name or name[0].isnumeric:
			name = 'Par' + name
1 Like