[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Equality of userdata
- From: "Tom Spilman" <tom@...>
- Date: Wed, 6 Oct 2004 01:26:22 -0500
I started switching some of my Lua based primitive types ( points, rects,
colors, etc ) over to userdata to gain some performance in a few places.
First tests I was getting 2x to 4x performance increase in most operations.
Then I realized I had forgotten that 'userdata == userdata' cannot be
overloaded thru the metatable.
What have others done to work around this issue? It's not very intuitive
when scripting that == isn't doing what you expect it to do and there is no
way to make it a compiler error or even a runtime warning. Sticking the
userdata behind a proxy will fix it, but at the sacrifice of performance for
all members. I'm left with "just remember to not use == with points".
Tom