lua-users home
lua-l archive

Re: NUL byte in string literal

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


On 4/2/2018 5:58 PM, Dirk Laurie wrote:
2018年04月02日 11:24 GMT+02:00 Matthew Wild:
Just a bit of feedback that I'm surprised hasn't come up before, but I
couldn't find it in the archives.
I feel the manual is a bit misleading when it says the following:
 Strings in Lua can contain any 8-bit value, including embedded zeros, which can be specified as '0円'.
While this is correct in most cases, it's not technically accurate
that you can actually always use 0円. If it is followed by numeric
digits, they will instead be interpreted instead as a numeric escape
sequence.
That leaves the only truly correct way of representing 0円 (that
doesn't depend on context) as 000円.
Not so. \x00 also works, and is IMHO preferable.
Anyway, all this is equally true of 1,円 2,円 etc, so the manual is
justified in making no song and dance about it when embedded zeros are
discussed.
I guess the important words in that sentence from the manual are "can be". [OT] That reminds me of a character called 'Canby' in a certain classic children's book... written by an architect.
--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia

AltStyle によって変換されたページ (->オリジナル) /