lua-users home
lua-l archive

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


> In _The implementation of Lua 5.0_, it says "The hash function does not look at all bytes of the string if the string is too long."
> 
> What is n such that strings that differ only from index n+1 will be evaluated as the same by Lua?

That's not how it works. For strings of length less than 32, all bytes
are visited. For longer strings, only every k bytes are visited, where
k = (l>>5)+1 and is the length. See luaS_newlstr in 
	http://www.lua.org/source/5.1/lstring.c.html