lua-users home
lua-l archive

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

Ah, this is exactly what is happening--I had forgotten about this.  In
fact, the reason why iterating over my list works while indexing into
does not is that I had written a __eq metamethod to compare the

So two questions remain:
1) Is there any way, on the userdata side, to change how it is used as
an index?
2) If I were to switch to light userdata, is there any way to guarantee
type safety (I assume no, because there is no metatable)?

Thanks again,

Date: Tue, 10 Feb 2004 14:06:03 -0500
From: scott <>
Subject: Re: Using full userdata as table index?
To: Lua list <>
Message-ID: <>
Content-Type: text/plain; charset=us-ascii

Just because your userdata object has the same value, doesn't mean that
it is the same object. AFAIK the table lookup occurs by reference, not
by value. Therefore, two different userdata objects could both be
refering to the same guid, but still be two refering to two different
lua objects. 
An example from my engine...