The expected "lexical" sort order is generally called "Alphanumerical sorting" or "Natural sorting". Standard c-type simple sort algorithms are usually for the sake of brevity and complexity not able to do that. Here's a few test implementations for lua:
http://notebook.kulchenko.com/algori...-humans-in-lua