[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: "attempt to compare number with userdata"
- From: "Peter Cawley" <lua@...>
- Date: Mon, 24 Nov 2008 14:49:27 +0000
>From the manual: "
getcomphandler defines how Lua chooses a metamethod
for comparison operators.
A metamethod only is selected when both objects
being compared have the same type
and the same metamethod for the selected operation." Hence userdata cannot be compared to non-userdata without modifing the Lua source.
On Mon, Nov 24, 2008 at 1:37 PM, Nikolai Kondrashov <Nikolai.Kondrashov@oktetlabs.ru>
Is there is a reason why I cannot compare a number with userdata? Provided
I have necessary metamethods?
The problem is we're using long-based Lua (on MIPS) and sometimes need to
deal with bigger integers, particularly 64-bit ones - only a few operations.
So I've implemented a simple Lua library in C operating on them. All
arithmetic operations work fine, but comparisons won't, giving "attempt to
compare number with userdata" message.
If there is no reason, then where should I look in Lua sources to fix that?