diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-20 22:10:57 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-20 22:10:57 +0530 |
| commit | fdeb33d34a97d062a120f72da919f81d7b1d45bf (patch) | |
| tree | 91165d5e3e718d4008bf73259f45d1705965f4b0 /src/LuaRuntime.cpp | |
| parent | 9e3474b5d8ee4afdd9c03cfb4a151ffebfca36b7 (diff) | |
| download | null-browser-fdeb33d34a97d062a120f72da919f81d7b1d45bf.tar.gz null-browser-fdeb33d34a97d062a120f72da919f81d7b1d45bf.zip | |
Move header files to src
Diffstat (limited to 'src/LuaRuntime.cpp')
| -rw-r--r-- | src/LuaRuntime.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/LuaRuntime.cpp b/src/LuaRuntime.cpp index e66c591..d89f7dc 100644 --- a/src/LuaRuntime.cpp +++ b/src/LuaRuntime.cpp @@ -1,24 +1,20 @@ +#include <QtCore> #include <lua.hpp> - -#include "LuaRuntime.hpp" - extern "C" { #include <luv.h> -// Forward declare luv registration function -// LUALIB_API int luaopen_luv(lua_State *L); } +#include "LuaRuntime.hpp" + LuaRuntime::LuaRuntime() { state = luaL_newstate(); luaL_openlibs(state); - luaopen_luv(state); - if (luaL_dostring(state, "_G.uv = require'luv'")) { - qDebug() << "Unable to load luv: " << lua_tostring(state, -1); - } else { - qDebug() << "succ"; - } + // Load `uv` (luv) + luaopen_luv(state); + lua_setglobal(state, "uv"); + // Load `web` luaL_Reg weblib[] = { {"open", &LuaRuntime::lua_onUrlOpen}, {"tabopen", &LuaRuntime::lua_onUrlTabOpen}, @@ -43,7 +39,7 @@ LuaRuntime::LuaRuntime() { // auto pp = R"( // print('Hello -- '); // local t = uv.new_timer(); - // uv.timer_start(t, 7000, 0, function() + // uv.timer_start(t, 4000, 0, function() // print('after time') // end); // uv.run(); |
