aboutsummaryrefslogtreecommitdiff
path: root/include/LuaRuntime.hpp
blob: 83ebf0c4b369ddf787250276bd39b253b8b4d493 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include <QtCore>
#include <lua.hpp>

#include "widgets/BrowserManager.hpp"

class LuaRuntime : public QObject {
  Q_OBJECT

public:
  static LuaRuntime *instance() {
    static LuaRuntime inst;
    return &inst;
  }

  void evaluate(QString code);

protected:
  LuaRuntime();
  ~LuaRuntime();

signals:
  void urlOpened(QString url, OpenType openType);

protected:
  static int lua_onUrlOpen(lua_State *state);
  static int lua_onUrlTabOpen(lua_State *state);

private:
  lua_State *state;
};