[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string immutability
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 2 Jan 2014 11:23:59 -0200
> It works just like table keys. A hash code is computed from the
> string. Only if that is the same as a string already in the table (in
> which case the strings are likely to be equal) are the actual strings
> compared. O(#str) average speed.
It is worth reminding that this behavior changed in Lua 5.2. Now, only
"short" strings are interned. (By default, a "short string" is up to
40 bytes.)
-- Roberto