From 9c812753e2b1f01b2e0c85be9904ff7694f0e6ec Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Thu, 1 May 2025 23:41:54 +0530 Subject: Implement NotificationReceived event --- src/events/Event.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/events/Event.hpp') diff --git a/src/events/Event.hpp b/src/events/Event.hpp index a0853d6..11f1141 100644 --- a/src/events/Event.hpp +++ b/src/events/Event.hpp @@ -8,6 +8,15 @@ lua_push##TYPE(state, VALUE); \ lua_settable(state, -3); +// Not a huge fan but looks nice +#define SET_FIELD_CLOSURE_WITH_SELF(NAME, CLOSURE) \ + lua_pushstring(state, NAME); \ + lua_pushlightuserdata(state, (void *)this); \ + lua_pushcclosure(state, CLOSURE, 1); \ + lua_settable(state, -3); + +#define GET_CLOSURE_SELF(TYPE) static_cast(lua_touserdata(state, lua_upvalueindex(1))); + class Event { public: QString kind = "-"; -- cgit v1.3.1