Lua: provide instance-equal check as '==' comparator.
This deprecated explicit the "sameinstance()" method
This commit is contained in:
@@ -378,7 +378,6 @@ struct CFunc
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T, class R>
|
||||
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>
|
||||
static int getPtrProperty (lua_State* L)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user