lua-users home
lua-l archive

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


On 12/3/05, Chris Marrin <chris@marrin.com> wrote:
> will the pointer s always be equal to the pointer prop? In all the cases
> I have tried it is. But can I rely on this?

It certainly is in the current implementation. The VM relies on
pointer equality for string comparisons, so you can too. But I seem to
recall that the last time this came up, it was pointed out that this
is not part of the standard, and may change in future versions (though
it's hard to think how).

A method that would clearly be compliant would be to store the strings
themselves, rather than the pointers. Because all Lua strings are
interned, comparisons are constant time.

Ben