lua-users home
lua-l archive

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


On Mon, Nov 9, 2009 at 7:22 PM, liam mail <liam.list@googlemail.com> 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.

-Duncan