Re: Comparing numerical objects for equality (patch)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Comparing numerical objects for equality (patch)
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 9 Jun 2022 12:08:52 -0300
> if a == 1 then -- metamethod __eq
You can write this instead:
if a:__eq(1) then
Not as pretty but not terrible either.
This assumes that the methods in your library work with objects and
numbers, promoting numbers to objects as needed.