lua-users home
lua-l archive

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


I am more or less out the lua bussiness ( I am very engaged with a real-time
project, and both me and lua 5.0 are not enough mature to get it into ).
Nevertheless, I just downloaded the 5.0-beta source tree, and flied to the
__eq metamethod implementation in lvm.c ( which I claimed for some moons
ago ).
Surprise: luaV_equalval still asserts for t1 and t2 being the same type !!!
A few lines before, luaV_lessequal does the same thing, even if not
´asserting´.
I ask to lua´s authors why this sort of draconian restriction when userdata
may be involved, and/or
a metamethod may be present for at least one of the operands in question.
( Yes, things go bad if _both_ operands have metamethods, and they are not
the same, but that would be the place for
luaG_ordererror .. )
A metamethod implemented as a C function, can easily check for the type of
its arguments, and
do what may seems convinient ( exactly, check the type of both and every
operand ).
Also, it seems to me that a metamethod implemented in lua code can also
check the operand types
( even if a little verbosely ).
My question goes far: I would _need_ this behaviour. Must I hack into the
sources myself ? Must I be
tied to, say, lua 5.0 beta forever because it would be no easy way to patch
future releases/versions ?
Also, I think the extra coding could not adversely affect total code size
nor speed to render lua
unusable ...
Marcelo Nicolet
currently, I am using mnicolet@satlink.com but my ISP is forcing me to use
the present account.