[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: What's a Lua object? Why LUA_TBOOLEAN and LUA_TLIGHTUSERDATA and LUA_TNUMBER are not Lua objects?
- From: Gé Weijers <ge@...>
- Date: Tue, 20 Oct 2020 11:22:34 -0700
On Tue, Oct 20, 2020 at 7:46 AM Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>
> > Strings are a bit different, because they're immutable, once created
> > they can't change, they act like values although they're garbage
> > collected, "a == b" returns string equality, even if these two strings
> > are not the same object in the interpreter (this will only happen for
> > long strings, over 32 bytes I think).
>
> 40 bytes (LUAI_MAXSHORTLEN).
I misremembered, 32 was related to the byte skipping used to speed up
the string hash (a 5 bit right shift is equivalent to a division by
32). The 'step' is calculated as (len >> LUAI_HASHLIMIT)+1.
--
Gé