lua-users home
lua-l archive

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

2009/12/18 Andreas Falkenhahn <>:
> Hi,
> I noticed that the following expression is actually FALSE in lua:
> "Big" > "ants"
> This seems to happen because of the difference in case because
> the following expression is TRUE:
> "Big" > "Ants"
> Is there any specific reason why lua does string comparison in
> this way? I.e. giving lower case characters a higher priority than
> all of the upper case characters? I.e. the following is TRUE:

Can you name a language which /doesn't/ do it this way?

> "a" > "Z"
> It's a little bit confusing... especially when using the sort() function
> of lua's table library.

t = {"Dave", "dave", "mary", "Mary", "Adam", "adam"}
table.sort(t, function (a, b) return a:upper() < b:upper() end);