lua-users home
lua-l archive

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


 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