aboutsummaryrefslogtreecommitdiff
path: root/include/LuaRuntime.hpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-09 22:09:09 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-09 23:41:36 +0530
commit6b1d49e607da16853d1a0f460dbe756538e4790c (patch)
treed5c784e6e568272afbb7530ea5dd752ce835b8fa /include/LuaRuntime.hpp
parent61f99089288138989cf244d174882aa5088b738b (diff)
downloadnull-browser-6b1d49e607da16853d1a0f460dbe756538e4790c.tar.gz
null-browser-6b1d49e607da16853d1a0f460dbe756538e4790c.zip
Add lua integration for command input (web.open, web.tabopen)
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;
+};