aboutsummaryrefslogtreecommitdiff
path: root/include/LuaRuntime.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/LuaRuntime.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/LuaRuntime.hpp b/include/LuaRuntime.hpp
new file mode 100644
index 0000000..85bb1ae
--- /dev/null
+++ b/include/LuaRuntime.hpp
@@ -0,0 +1,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(const char *code);
+
+protected:
+ LuaRuntime();
+ ~LuaRuntime();
+
+signals:
+ void urlOpenned(QString url, OpenType openType);
+
+protected:
+ static int lua_onUrlOpen(lua_State *state);
+ static int lua_onUrlTabOpen(lua_State *state);
+
+private:
+ lua_State *state;
+};