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 41caad5 commit 4fae7ee
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/luaexport/LuaEventHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,28 @@ ssig::ScopedConnection<Signature>* makeConnection(
return new ssig::ScopedConnection<Signature>(con);
}

namespace luabind {
template <typename Signature>
struct default_converter<ssig::Connection<Signature>>
: native_converter_base<ssig::Connection<Signature>>
{
void to(lua_State* L, ssig::Connection<Signature> const& value)
{
luabind::object o(
L, static_cast<ssig::ConnectionBase*>(makeConnection(value)));
o.push(L);
}
};

template <typename Signature>
struct default_converter<ssig::Connection<Signature> const>
: default_converter<ssig::Connection<Signature>>
{};

template <typename Signature>
struct default_converter<ssig::Connection<Signature> const&>
: default_converter<ssig::Connection<Signature>>
{};
} // namespace luabind

#endif // include guard

0 comments on commit 4fae7ee

Please sign in to comment.