lua-users home
lua-l archive

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

That's essentially what I did with __tostring, but I had to restore it back to its old value later.  Kinda hackish, but I guess it works.

Cool, thanks!

On 5/21/07, Peter Odding <> wrote:
Matthew Armstrong wrote:
> I'm pretty sure the 'No such operator defined' error is coming from
> luabind,
> as the userdata I'm running this on comes from a luabind created object.
> If I temporarily remove the __tostring metamethod, the error goes away, so
> that solves my problem.
> Another thing luabind does is override the __eq metamethod, to what it
> thinks == should be, which is a somewhat complicated definition.  What if I
> want to compare two userdata objects solely based on whether the references
> are equal?

Not sure whom you are asking, so just in case: I have no idea. Until 5 minutes
ago I didn't know about luabind ;) (and I wouldn't touch C++ with a ten-foot
pole). Good luck though.

  - Peter Odding

PS. As a quick hack you could consider debug.getmetatable(foo).__eq = nil, which
should get you back to the default behavior.