allow to compare C class instances from lua
[ardour.git] / libs / lua / LuaBridge / detail / CFunctions.h
index 29b361b69085730662e04c708966c40ae9e16136..6f439192163948f6ab3acec5d907df58f3f3c24b 100644 (file)
@@ -366,6 +366,19 @@ struct CFunc
     }
   };
 
+  template <class T>
+  struct ClassEqualCheck
+  {
+    static int f (lua_State* L)
+    {
+      T const* const t0 = Userdata::get <T> (L, 1, true);
+      T const* const t1 = Userdata::get <T> (L, 2, true);
+      Stack <bool>::push (L, t0 == t1);
+      return 1;
+    }
+  };
+
+
   template <class T>
   struct PtrNullCheck
   {