diff options
Diffstat (limited to '')
| -rw-r--r-- | src/events/Event.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
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<TYPE>(lua_touserdata(state, lua_upvalueindex(1))); + class Event { public: QString kind = "-"; |
