lua-users home
lua-l archive

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


> For strings in Lua source code, lexicographic ordering is obviously
> locale-dependent.  But how much can one rely on?  Lua runs on some
> non-ASCII compliant platforms (EBCDIC springs to mind), but is there
> any platform supporting Lua
> on which the following program prints something?
> 
>       s =" 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
>       for i=2,#s do if s:sub(i,i)<=s:sub(i-1,i-1) then print(i) end end

This will print something in EBCDIC because 'A' < '9' there according to [1].
I haven't tested it though, not having access to an EBCDIC machine...

[1] http://en.wikipedia.org/wiki/Extended_Binary_Coded_Decimal_Interchange_Code