lua-users home
lua-l archive

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


> If I remeber correctly I have read somewhere that strings in Lua
> have special internal representation and Lua does not look at
> every byte in them.

Lua does not look at every byte in a string for computing its hash value
when the string is interned in Lua. After that, Lua looks into a chain
of strings with the same hash to determine whether the string is already
present in Lua. At that moment, Lua looks at all bytes using memcmp.
See http://www.lua.org/source/5.1/lstring.c.html#luaS_newlstr

--lhf