mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-13 01:56:34 +01:00
Lua: provide instance-equal check as '==' comparator.
This deprecated explicit the "sameinstance()" method
This commit is contained in:
parent
6c65fd41cb
commit
a2094b6831
2 changed files with 30 additions and 1 deletions
|
|
@ -378,7 +378,6 @@ struct CFunc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <class T, class R>
|
template <class T, class R>
|
||||||
struct CastClass
|
struct CastClass
|
||||||
{
|
{
|
||||||
|
|
@ -461,6 +460,24 @@ struct CFunc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct ClassEqualCheck<boost::shared_ptr<T> >
|
||||||
|
{
|
||||||
|
static int f (lua_State* L)
|
||||||
|
{
|
||||||
|
return PtrEqualCheck<T>::f (L);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct ClassEqualCheck<boost::weak_ptr<T> >
|
||||||
|
{
|
||||||
|
static int f (lua_State* L)
|
||||||
|
{
|
||||||
|
return WPtrEqualCheck<T>::f (L);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <class C, typename T>
|
template <class C, typename T>
|
||||||
static int getPtrProperty (lua_State* L)
|
static int getPtrProperty (lua_State* L)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -579,10 +579,14 @@ private:
|
||||||
createConstTable (name);
|
createConstTable (name);
|
||||||
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
||||||
rawsetfield (L, -2, "__gc");
|
rawsetfield (L, -2, "__gc");
|
||||||
|
lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
|
||||||
|
rawsetfield (L, -2, "__eq");
|
||||||
|
|
||||||
createClassTable (name);
|
createClassTable (name);
|
||||||
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
||||||
rawsetfield (L, -2, "__gc");
|
rawsetfield (L, -2, "__gc");
|
||||||
|
lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
|
||||||
|
rawsetfield (L, -2, "__eq");
|
||||||
|
|
||||||
createStaticTable (name);
|
createStaticTable (name);
|
||||||
|
|
||||||
|
|
@ -626,10 +630,14 @@ private:
|
||||||
createConstTable (name);
|
createConstTable (name);
|
||||||
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
||||||
rawsetfield (L, -2, "__gc");
|
rawsetfield (L, -2, "__gc");
|
||||||
|
lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
|
||||||
|
rawsetfield (L, -2, "__eq");
|
||||||
|
|
||||||
createClassTable (name);
|
createClassTable (name);
|
||||||
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
||||||
rawsetfield (L, -2, "__gc");
|
rawsetfield (L, -2, "__gc");
|
||||||
|
lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
|
||||||
|
rawsetfield (L, -2, "__eq");
|
||||||
|
|
||||||
createStaticTable (name);
|
createStaticTable (name);
|
||||||
|
|
||||||
|
|
@ -1159,10 +1167,14 @@ private:
|
||||||
createConstTable (name);
|
createConstTable (name);
|
||||||
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
||||||
rawsetfield (L, -2, "__gc");
|
rawsetfield (L, -2, "__gc");
|
||||||
|
lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
|
||||||
|
rawsetfield (L, -2, "__eq");
|
||||||
|
|
||||||
createClassTable (name);
|
createClassTable (name);
|
||||||
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
lua_pushcfunction (L, &CFunc::gcMetaMethod <T>);
|
||||||
rawsetfield (L, -2, "__gc");
|
rawsetfield (L, -2, "__gc");
|
||||||
|
lua_pushcclosure (L, &CFunc::ClassEqualCheck <T>::f, 0);
|
||||||
|
rawsetfield (L, -2, "__eq");
|
||||||
|
|
||||||
createStaticTable (name);
|
createStaticTable (name);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue