[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: oops, was strings with length 0 "disappear" in table
- From: startx <startx@...>
- Date: Thu, 8 Dec 2011 13:48:58 +0000
On Thu, 8 Dec 2011 13:26:11 +0100
Patrick Rapin <firstname.lastname@example.org> wrote:
> Internally, Lua adds an extra zero byte at the end of any string (so
> also for the empty string), but this is only to simplify interfacing
> with C host code. Lua by itself never use that zero terminating byte
> nor count it in the length ; it stores the length of a string together
> with the pointer and the hash value.
cheers, that answers my question :)
> For example, if #s == 2.125, that would mean there are 17 meaningful
> bits in it !
this again confuses me, but i leave it at that for now ;)