[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Uniqueness of references
- From: Diego Nehab <diego@...>
- Date: Tue, 22 Jan 2002 14:46:45 -0200 (EDT)
Hi,
> If I get two references to the same Lua object with lua_ref(), should
> they have the same integer value?
>
> I'm trying to match objects passed in subsequent calls to my API:
>
> function myFunc() ... end
>
> registerObject(myFunc)
> ...
> unregisterObject(myFunc)
>
> Currently when I try to compare the references obtained in my C
> implementations of these registration functions, I get different values.
> Is this right? Is there a way around it?
They are and should be different: you might want to have two independent
locks on a single object. To compare objects pointed to by references,
first get the objects themselves on the Lua stack (lua_getref), and
than compare them (lua_equal).
Regards,
Diego.