[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Will operator '==' support fulluserdata and number or nil or false
- From: 奥斯陆君王 <qtiuto@...>
- Date: Sun, 24 Feb 2019 14:58:57 +0800
I think the following two statement should be equal
1. v>= 1 and v <= 1
2. v== 1
Howerver, they may produce two different result for a userdata or a
table that override the metamethod correctly(ignore the bad cases).
Provide a way to let them result both true?
For compatiblity, other than allow it for __eq metamethod, a better
way will be add a new metamethod entry like __peq (equal to primitive
I got the idea when I found out there is no way to make
ffi.new('int',1)==1 for standard lua. I think you may advise me to add
a method like ffi.equals or patch the vm by myself(patch every
version? a diff file?). All of them are possible ways. But if lua
does support it, it will be less time-consuming to port luajit codes
to lua since luajit seems dying.