[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Full userdata and metamethods (mail resent)
- From: Duncan Cross <duncan.cross@...>
- Date: Mon, 9 Nov 2009 19:37:00 +0000
On Mon, Nov 9, 2009 at 7:22 PM, liam mail <firstname.lastname@example.org> wrote:
> I have come across something that I am unsure if it is expected behaviour or
> a bug and would like some help to identify which it is.
> int equal(lua_State* s)
> Int_wrapper* i1 = static_cast<Int_wrapper *>( lua_touserdata(s, 1) );
> Int_wrapper* i2 = static_cast<Int_wrapper *>( lua_touserdata(s, 2) );
> lua_pushinteger(s, i1->i == i2->i ? 1 : 0 );
> return 1;
I believe that the __eq metamethod (as well as the other comparison
metamethods) must return a boolean in order to work properly, so that
may be your problem.