Skip to content

Commit

Permalink
Add support basic luabind converter for ssig::Connection<Signature>.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oberon00 committed Jul 26, 2013
1 parent 4fae7ee commit 6f9c7a8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/luaexport/LuaEventHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
#define LUA_EVENT_HELPERS_HPP_INCLUDED LUA_EVENT_HELPERS_HPP_INCLUDED

#include "LuaFunction.hpp"

#include <boost/bind.hpp>
#include <luabind/adopt_policy.hpp>
#include <ssig.hpp>


#define LUA_EVENT_HELPERS_MAX_ARGS SSIG_MAX_ARGS

#define JD_EVENT_ENTRY(ename, r, ...) \
Expand All @@ -37,9 +35,8 @@

#define JD_EVENT_TABLE_END return nullptr; }


template<typename Signature>
ssig::ScopedConnection<Signature>* makeConnection(
ssig::ConnectionBase* makeConnection(
ssig::Connection<Signature> const& con)
{
return new ssig::ScopedConnection<Signature>(con);
Expand All @@ -52,8 +49,7 @@ namespace luabind {
{
void to(lua_State* L, ssig::Connection<Signature> const& value)
{
luabind::object o(
L, static_cast<ssig::ConnectionBase*>(makeConnection(value)));
luabind::object o(L, makeConnection(value), luabind::adopt(luabind::result));
o.push(L);
}
};
Expand All @@ -69,4 +65,6 @@ namespace luabind {
{};
} // namespace luabind

#define JD_EVENT(name, cname) def("on" #cname, &LHCURCLASS::connect_##name)

#endif // include guard

0 comments on commit 6f9c7a8

Please sign in to comment.