From 23b8c2c0da0317562925d574e774cedb6a93a7ac Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 29 Mar 2025 14:23:35 +0530 Subject: Replace fetchers with fetch methods on router --- src/LuaRuntime.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/LuaRuntime.cpp') 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 #include 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; -- cgit v1.3.1