aboutsummaryrefslogtreecommitdiff
path: root/src/events/Event.hpp
blob: a0853d69c68dd077f9edab8a62c49e7f7ada5edb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma once

#include <QtCore>
#include <lua.hpp>

#define SET_FIELD(NAME, TYPE, VALUE)                                                               \
  lua_pushstring(state, NAME);                                                                     \
  lua_push##TYPE(state, VALUE);                                                                    \
  lua_settable(state, -3);

class Event {
public:
  QString kind = "-";

  virtual void lua_push(lua_State *state) const {
    lua_newtable(state);
    SET_FIELD("type", string, kind.toStdString().c_str())
  };
};