[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Custom type methods (and name)
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 19 Feb 2016 08:07:25 -0200
> local cx = complex.new(0, 0)
> local cx2 = complex.new(1, 1)
> print(cx < cx2)
>
> and the mesasge 'attempt to compare two userdata values'
Indeed, my complex library does not set the __lt metamethod since I thought
it made no sense.
If you want better error message, do
complex.__lt=function () error"complex numbers cannot be compared" end