aboutsummaryrefslogtreecommitdiff
path: root/src/LuaRuntime.hpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-07-27 14:54:56 +0530
committerAkshay Nair <phenax5@gmail.com>2025-07-27 14:54:56 +0530
commit9ece6a733f0c3bfd518ee14f520aed70124fac12 (patch)
tree54d045b187d39bf05c6f2653adb78bf2088f45ce /src/LuaRuntime.hpp
parentf13a1a1c4eab8bdef3760dd71cd7e2b3cc68a3e8 (diff)
downloadnull-browser-9ece6a733f0c3bfd518ee14f520aed70124fac12.tar.gz
null-browser-9ece6a733f0c3bfd518ee14f520aed70124fac12.zip
Add more tests for api + webview + webviewstack
Diffstat (limited to 'src/LuaRuntime.hpp')
-rw-r--r--src/LuaRuntime.hpp50
1 files changed, 3 insertions, 47 deletions
diff --git a/src/LuaRuntime.hpp b/src/LuaRuntime.hpp
index 0e4584d..04c17bc 100644
--- a/src/LuaRuntime.hpp
+++ b/src/LuaRuntime.hpp
@@ -6,12 +6,10 @@
#include <optional>
#include "AsyncEventLoop.hpp"
-#include "lua.h"
#include "utils.hpp"
#include "widgets/BrowserWindow.hpp"
#include "widgets/Decorations.hpp"
#include "widgets/WebView.hpp"
-#include "widgets/WebViewStack.hpp"
#ifndef PROJECT_LUA_PATH
#define PROJECT_LUA_PATH ""
@@ -79,50 +77,8 @@ private:
lua_State *state;
AsyncEventLoop *event_loop = nullptr;
- // TEMP
public:
- static void inspect_lua_stack(lua_State *state) {
- int top = lua_gettop(state);
- qDebug() << "--- Lua Stack (top: " << top << ") ---\n";
-
- for (int i = 1; i <= top; i++) {
- int type = lua_type(state, i);
- qDebug() << " " << i << ": " << lua_typename(state, type);
- }
-
- qDebug() << "---------------------------\n";
- lua_settop(state, top);
- }
-
- static std::vector<QString> lua_tostringlist(lua_State *state) {
- std::vector<QString> values;
- if (!lua_istable(state, -1))
- return values;
-
- lua_pushnil(state); // First key for lua_next()
- while (lua_next(state, -2) != 0) {
- if (lua_isstring(state, -1))
- values.emplace_back(lua_tostring(state, -1));
- lua_pop(state, 1);
- }
- lua_pop(state, 1);
-
- return values;
- }
-
- static QVariant get_lua_value(lua_State *state, int idx, QVariant default_value = 0) {
- if (lua_isnoneornil(state, idx))
- return default_value;
-
- if (lua_isstring(state, idx))
- return lua_tostring(state, idx);
-
- if (lua_isboolean(state, idx))
- return lua_toboolean(state, idx);
-
- if (lua_isnumber(state, idx))
- return lua_tonumber(state, idx);
-
- return lua_tostring(state, idx);
- }
+ static void inspect_lua_stack(lua_State *state);
+ static std::vector<QString> lua_tostringlist(lua_State *state);
+ static QVariant get_lua_value(lua_State *state, int idx, QVariant default_value = 0);
};