From fdeb33d34a97d062a120f72da919f81d7b1d45bf Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Thu, 20 Mar 2025 22:10:57 +0530 Subject: Move header files to src --- src/LuaRuntime.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/LuaRuntime.cpp') 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 #include - -#include "LuaRuntime.hpp" - extern "C" { #include -// 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(); -- cgit v1.3.1