lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi
 
I am trying to sort a big list of arbitrary keyname strings in a table. I am using the standard table sort with a custom sort function. The little snag I hit was with strings like this
 
ABC_1
ABC_2
ABC_19
ABC_20
 
I want to do a lexical sort on my strings but for strings like those above, sort in that order, but of course I get
 
ABC_1
ABC_19
ABC_2
ABC_20
 
I cant think of a concise Lua way of doing a lexical sort of strings but still manage to get these numeric type examples correct too. Any suggestions please ?
 
Regards Geoff