lua-users home
lua-l archive

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


> 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