Getting Selected Objects Name

How can I get the name of a selected object when a mel script is run. Also to select things in order how would I do that just -select name??? Thanks!!!!

string $selection[] = ls -sl;
this writes the names of the selected objects into the $selection array

or MGlobal::getActiveSelectionList( list ); in the API :slight_smile: