lua-users home
lua-l archive

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


On Sat, Nov 29, 2008 at 11:47 AM, Paul Sheer <paulsheer@gmail.com> wrote:
> When string.append() is called on a flex string, it just fills in more of
> the buffer and adjusts the length. Its hash value does not change.

Hash value is pretty important in lua implementation, isn't it?

Will your string post-append compare as if it was still its original value?

Won't any attempts to create a new string return not a new string object,
but your original one if the hashs are identical?

so

x = string.append("x", "y")
-- hash of x is that of "x"?

z = "x"

-- z will be the object that x points to, lua doesn't create duplicate
string objects
-- when it knows the string data is identical, but the current value
of x is "xy"

Have you done something to avoid this?

Sam