aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-08 00:40:52 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-08 00:40:52 +0530
commitecd3ccde166910e3667b7b1a064e9c6db52d1646 (patch)
tree8452ec16569fdfbd2bce2fb9aa4f277484e7c7d8 /src/main.cpp
parent4ce5d59c41d4217f02e6f84c6e531fbc4ee20122 (diff)
downloadnull-browser-ecd3ccde166910e3667b7b1a064e9c6db52d1646.tar.gz
null-browser-ecd3ccde166910e3667b7b1a064e9c6db52d1646.zip
Add luajit embedding
Diffstat (limited to '')
-rw-r--r--src/main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 03bc7c2..8fbfee1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2,8 +2,24 @@
#include <QVBoxLayout>
#include <QWebEngineView>
#include <QWidget>
+#include <lua.hpp>
int main(int argc, char *argv[]) {
+ auto L = luaL_newstate();
+
+ luaL_openlibs(L); /* Load Lua libraries */
+
+ /* Load the file containing the script we are going to run */
+ auto status = luaL_dostring(L, "print(500 + 10 * 3)");
+ if (status) {
+ /* If something went wrong, error message is at the top of */
+ /* the stack */
+ fprintf(stderr, "Couldn't load file: %s\n", lua_tostring(L, -1));
+ exit(1);
+ }
+ lua_close(L);
+ exit(0);
+
QApplication app(argc, argv);
QWidget mainWindow;
mainWindow.setWindowTitle("web-browser");