lua-users home
lua-l archive

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


Hi,

I’m not sure if this is a proper fix, but it looks like v5.4.3 (and master branch) contains a bug if we define LUA_FLOORN2I=1 when we try to compare an integer value == a number. This is a possible fix:

diff --git a/lvm.c b/lvm.c
index c9729bcc..a37ec3cf 100644
--- a/lvm.c
+++ b/lvm.c
@@ -572,8 +572,8 @@ int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) {
          integer value, they cannot be equal; otherwise, compare their
          integer values. */
       lua_Integer i1, i2;
-      return (luaV_tointegerns(t1, &i1, F2Ieq) &&
-              luaV_tointegerns(t2, &i2, F2Ieq) &&
+      return (luaV_tointegerns(t1, &i1, LUA_FLOORN2I) &&
+              luaV_tointegerns(t2, &i2, LUA_FLOORN2I) &&
               i1 == i2);
     }
   }