From ba4d403119a054e7c27b33016a0b78bf73eeed24 Mon Sep 17 00:00:00 2001 From: Squibid Date: Mon, 20 Oct 2025 18:28:40 -0400 Subject: [PATCH] omg lua in mez --- build.zig | 2 ++ build.zig.zon | 4 ++++ src/main.zig | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/build.zig b/build.zig index 2aa4bbe..753997c 100644 --- a/build.zig +++ b/build.zig @@ -31,6 +31,7 @@ pub fn build(b: *std.Build) void { const xkbcommon = b.dependency("xkbcommon", .{}).module("xkbcommon"); const pixman = b.dependency("pixman", .{}).module("pixman"); const wlroots = b.dependency("wlroots", .{}).module("wlroots"); + const zlua = b.dependency("zlua", .{}).module("zlua"); wlroots.addImport("wayland", wayland); wlroots.addImport("xkbcommon", xkbcommon); @@ -53,6 +54,7 @@ pub fn build(b: *std.Build) void { mez.root_module.addImport("wayland", wayland); mez.root_module.addImport("xkbcommon", xkbcommon); mez.root_module.addImport("wlroots", wlroots); + mez.root_module.addImport("zlua", zlua); mez.linkSystemLibrary("wayland-server"); mez.linkSystemLibrary("xkbcommon"); diff --git a/build.zig.zon b/build.zig.zon index 9715c07..6424066 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -20,6 +20,10 @@ .url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.19.3.tar.gz", .hash = "wlroots-0.19.3-jmOlcuL_AwBHhLCwpFsXbTizE3q9BugFmGX-XIxqcPMc", }, + .zlua = .{ + .url = "git+https://github.com/natecraddock/ziglua#39f8df588d0864070deffa308ef575bf492777a0", + .hash = "zlua-0.1.0-hGRpC6E9BQDBGKPqzmCRsI6Xd8jH9KohccmX69-L6HyS", + }, }, .paths = .{ "build.zig", diff --git a/src/main.zig b/src/main.zig index 03f816f..97c3abf 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,6 +1,9 @@ const std = @import("std"); const wlr = @import("wlroots"); +const zlua = @import("zlua"); +const Lua = zlua.Lua; + const Server = @import("server.zig"); const gpa = std.heap.c_allocator; @@ -10,6 +13,11 @@ pub var server: Server = undefined; pub fn main() !void { wlr.log.init(.err, null); + var lua = try Lua.init(gpa); + defer lua.deinit(); + lua.openLibs(); + lua.doString("print('Hello from Lua embedded in Zig!')") catch {}; + std.log.info("Starting mezzaluna", .{}); try server.init();