[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Compare by value.
- From: Asko Kauppi <asko.kauppi@...>
- Date: Mon, 11 Aug 2003 23:21:50 +0300
push them as numbers and not as userdata?
or: check the "__eq" metamethod (manual page 17) & set it for the userdata.
(perhaps the latter is better - you'll use ints and not doubles, plus it's more elegant.. ;)
Leigh McRae kirjoittaa maanantaina, 11. elokuuta 2003, kello 23:01:
I am having trouble getting lua to compare my own C++ types. I have a class called Handle that is simply a 32bit int that gets mapped to a pointer (Low 16bits for ID and high 16bit for a magic number). When I push these on the stack to get compared, I believe they are getting compared by thier memory location. Other than writing a function that compares two Handles, how can I get lua to compare them as if they are numbers, which they are?
Leigh McRae
Lead Programmer
Rockstar Games Toronto
www.rockstargames.com