lua-users home
lua-l archive

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

> Peter Cawley wrote:
> Not to mention that the hex notation follows the Principle Of Least
> Surprise, which the decimal one doesn't; take the following two sequences:
> \102\101\100\099\098\097
> \x92\x91\x90\x8f\x8e\x8d
> One of these contains a nasty surprise...

Hm. I don't get it:

Lua 5.1.3  Copyright (C) 1994-2008, PUC-Rio
> ="\102\101\100\099\098\097"
> ="\98"
> ="\098"

It is just the way I would expect it - at least in Lua. I would have
been surprised if \0xx would be an octal notation in Lua....

Though I do agree that a hexadecimal notation in strings would be more
convenient in quite a few cases than the decimal notation. Actually,
when I once built a binary string, I was surprised that Lua supports
only decimal values.
A Lua function that converts strings in a more convenient way is
possible, but I think it would be nice if the compiler would support
this natively.