aboutsummaryrefslogtreecommitdiff
path: root/src/LuaRuntime.cpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-29 14:23:35 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-29 15:58:20 +0530
commit23b8c2c0da0317562925d574e774cedb6a93a7ac (patch)
tree0704ffda4e8f2f1b442fd9fc6b31e025b4a4521e /src/LuaRuntime.cpp
parented15eba453b7ddd0f4962c2d381fe40751973131 (diff)
downloadnull-browser-23b8c2c0da0317562925d574e774cedb6a93a7ac.tar.gz
null-browser-23b8c2c0da0317562925d574e774cedb6a93a7ac.zip
Replace fetchers with fetch methods on router
Diffstat (limited to '')
-rw-r--r--src/LuaRuntime.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/LuaRuntime.cpp b/src/LuaRuntime.cpp
index 0ef7ef8..2e711cb 100644
--- a/src/LuaRuntime.cpp
+++ b/src/LuaRuntime.cpp
@@ -1,3 +1,4 @@
+#include "WindowActionRouter.hpp"
#include <QtCore>
#include <lua.hpp>
extern "C" {
@@ -74,6 +75,7 @@ void LuaRuntime::init_web_lib() {
// web
luaL_Reg web[] = {
+ /// @deprecated
{"open", &LuaRuntime::lua_open_url},
{nullptr, nullptr},
};
@@ -169,15 +171,15 @@ int LuaRuntime::lua_keymap_set(lua_State *state) {
}
int LuaRuntime::lua_tab_current(lua_State *state) {
- auto *runtime = LuaRuntime::instance();
- auto tab_id = runtime->fetch_current_tab_id();
+ auto *router = WindowActionRouter::instance();
+ auto tab_id = router->fetch_current_tab_id();
lua_pushinteger(state, tab_id);
return 1;
}
int LuaRuntime::lua_tab_list(lua_State *state) {
- auto *runtime = LuaRuntime::instance();
- auto tabs = runtime->fetch_webview_data_list();
+ auto *router = WindowActionRouter::instance();
+ auto tabs = router->fetch_webview_data_list();
lua_newtable(state);
int index = 1; // 1-indexed
@@ -196,7 +198,8 @@ int LuaRuntime::lua_tab_list(lua_State *state) {
lua_pushstring(state, tab.title.toStdString().c_str());
lua_settable(state, -3);
- lua_rawseti(state, -2, index++);
+ lua_rawseti(state, -2, index);
+ index++;
}
return 1;