From 6f9c7a80df79ab69a5070b11df4302aebeaeae4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Neun=C3=BCller?= Date: Fri, 26 Jul 2013 16:31:40 +0200 Subject: [PATCH] Add support basic luabind converter for ssig::Connection. --- src/luaexport/LuaEventHelpers.hpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/luaexport/LuaEventHelpers.hpp b/src/luaexport/LuaEventHelpers.hpp index 3862425..7e30ad5 100644 --- a/src/luaexport/LuaEventHelpers.hpp +++ b/src/luaexport/LuaEventHelpers.hpp @@ -6,11 +6,9 @@ #define LUA_EVENT_HELPERS_HPP_INCLUDED LUA_EVENT_HELPERS_HPP_INCLUDED #include "LuaFunction.hpp" - -#include +#include #include - #define LUA_EVENT_HELPERS_MAX_ARGS SSIG_MAX_ARGS #define JD_EVENT_ENTRY(ename, r, ...) \ @@ -37,9 +35,8 @@ #define JD_EVENT_TABLE_END return nullptr; } - template -ssig::ScopedConnection* makeConnection( +ssig::ConnectionBase* makeConnection( ssig::Connection const& con) { return new ssig::ScopedConnection(con); @@ -52,8 +49,7 @@ namespace luabind { { void to(lua_State* L, ssig::Connection const& value) { - luabind::object o( - L, static_cast(makeConnection(value))); + luabind::object o(L, makeConnection(value), luabind::adopt(luabind::result)); o.push(L); } }; @@ -69,4 +65,6 @@ namespace luabind { {}; } // namespace luabind +#define JD_EVENT(name, cname) def("on" #cname, &LHCURCLASS::connect_##name) + #endif // include guard