aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/EventListener.hpp
diff options
context:
space:
mode:
authorAndy Belle-Isle <abelleisle@protonmail.com>2022-11-13 13:55:26 -0600
committerAndy Belle-Isle <abelleisle@protonmail.com>2022-11-13 13:55:26 -0600
commit38e2036d031bdeaea76ef4b6c3c2af5247ed93ec (patch)
treeb1401ba2ef33d08dbc528aadbf61f0d4aedad63d /src/components/EventListener.hpp
parent57a1eb6fdccb9023557d0a470796f423f063948a (diff)
parent57013add5b7c524086272be7d395f9ec5109bde2 (diff)
Merge remote-tracking branch 'origin/lib-cleanup' into world
Diffstat (limited to 'src/components/EventListener.hpp')
-rw-r--r--src/components/EventListener.hpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/components/EventListener.hpp b/src/components/EventListener.hpp
index 77a004e..fb55d95 100644
--- a/src/components/EventListener.hpp
+++ b/src/components/EventListener.hpp
@@ -42,16 +42,17 @@ public:
return *this;
}
- void tryListener(const std::string& name, sol::table& self)
+ template<typename... Args>
+ void tryListener(const std::string& name, sol::table& self, Args... args)
{
if (listeners[name] == sol::type::function)
- listeners[name](self);
+ listeners[name](self, args...);
}
void serialize([[maybe_unused]] cereal::JSONOutputArchive& ar) final {}
void serialize([[maybe_unused]] cereal::JSONInputArchive& ar) final {}
- std::string serializeName(void) const final {
+ virtual std::string serializeName(void) const final {
return "EventListener";
}
};