diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-23 16:59:16 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-23 16:59:34 +0530 |
| commit | 18b3e4939931c0d2bf779d2e52cb0c90e282ec97 (patch) | |
| tree | e9afabef77660b8cfcd8a37006c9db38c4bc8aa6 /src/LuaRuntime.hpp | |
| parent | 1f018902a8e1d1138c9a56106bce7aa7982a247b (diff) | |
| download | null-browser-18b3e4939931c0d2bf779d2e52cb0c90e282ec97.tar.gz null-browser-18b3e4939931c0d2bf779d2e52cb0c90e282ec97.zip | |
Fix segfault with evaluate, add keymap accidentally popping wrong value
+ add demnu config.lua example
Diffstat (limited to 'src/LuaRuntime.hpp')
| -rw-r--r-- | src/LuaRuntime.hpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/LuaRuntime.hpp b/src/LuaRuntime.hpp index 9f672e9..3d44282 100644 --- a/src/LuaRuntime.hpp +++ b/src/LuaRuntime.hpp @@ -7,6 +7,11 @@ #include "AsyncEventLoop.hpp" #include "widgets/WebViewStack.hpp" +#define preserveTop(STATE, BODY) \ + int __top = lua_gettop(STATE); \ + BODY; \ + lua_settop(STATE, __top); + class LuaRuntime : public QObject { Q_OBJECT @@ -17,16 +22,14 @@ public: } void evaluate(QString code); - QVariant evaluateSync(QString code); - void loadFile(QString path); + QVariant evaluateSync(QString code); void stopEventLoop(); void startEventLoop(); - - QVariant getValue(int idx); - DELEGATE(eventLoop, queueTask, queueTask) + + QVariant getLuaValue(int idx); DEFINE_GETTER(getState, state) signals: @@ -39,6 +42,7 @@ signals: protected: LuaRuntime(); ~LuaRuntime(); + void initWebLib(); static int lua_onUrlOpen(lua_State *state); static int lua_onUrlTabOpen(lua_State *state); static int lua_addKeymap(lua_State *state); |
