Lua: provide instance-equal check as '==' comparator.
[ardour.git] / libs / lua / LuaBridge / detail / Namespace.h
index 3644b9e1572ba125de74259a1ad067f04bf9a6b4..b661093e2b25db3eb620b9f5e55112eeaffb16b8 100644 (file)
@@ -579,10 +579,14 @@ private:
         createConstTable (name);
         lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
         rawsetfield (L, -2, "__gc");
+        lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
+        rawsetfield (L, -2, "__eq");
 
         createClassTable (name);
         lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
         rawsetfield (L, -2, "__gc");
+        lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
+        rawsetfield (L, -2, "__eq");
 
         createStaticTable (name);
 
@@ -626,10 +630,14 @@ private:
       createConstTable (name);
       lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
       rawsetfield (L, -2, "__gc");
+      lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
+      rawsetfield (L, -2, "__eq");
 
       createClassTable (name);
       lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
       rawsetfield (L, -2, "__gc");
+      lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
+      rawsetfield (L, -2, "__eq");
 
       createStaticTable (name);
 
@@ -1159,10 +1167,14 @@ private:
         createConstTable (name);
         lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
         rawsetfield (L, -2, "__gc");
+        lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
+        rawsetfield (L, -2, "__eq");
 
         createClassTable (name);
         lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
         rawsetfield (L, -2, "__gc");
+        lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
+        rawsetfield (L, -2, "__eq");
 
         createStaticTable (name);