omg lua in mez

This commit is contained in:
Squibid 2025-10-20 18:28:40 -04:00
parent f9e67a5681
commit ba4d403119
Signed by: squibid
GPG key ID: BECE5684D3C4005D
3 changed files with 14 additions and 0 deletions

View file

@ -31,6 +31,7 @@ pub fn build(b: *std.Build) void {
const xkbcommon = b.dependency("xkbcommon", .{}).module("xkbcommon"); const xkbcommon = b.dependency("xkbcommon", .{}).module("xkbcommon");
const pixman = b.dependency("pixman", .{}).module("pixman"); const pixman = b.dependency("pixman", .{}).module("pixman");
const wlroots = b.dependency("wlroots", .{}).module("wlroots"); const wlroots = b.dependency("wlroots", .{}).module("wlroots");
const zlua = b.dependency("zlua", .{}).module("zlua");
wlroots.addImport("wayland", wayland); wlroots.addImport("wayland", wayland);
wlroots.addImport("xkbcommon", xkbcommon); 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("wayland", wayland);
mez.root_module.addImport("xkbcommon", xkbcommon); mez.root_module.addImport("xkbcommon", xkbcommon);
mez.root_module.addImport("wlroots", wlroots); mez.root_module.addImport("wlroots", wlroots);
mez.root_module.addImport("zlua", zlua);
mez.linkSystemLibrary("wayland-server"); mez.linkSystemLibrary("wayland-server");
mez.linkSystemLibrary("xkbcommon"); mez.linkSystemLibrary("xkbcommon");

View file

@ -20,6 +20,10 @@
.url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.19.3.tar.gz", .url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.19.3.tar.gz",
.hash = "wlroots-0.19.3-jmOlcuL_AwBHhLCwpFsXbTizE3q9BugFmGX-XIxqcPMc", .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 = .{ .paths = .{
"build.zig", "build.zig",

View file

@ -1,6 +1,9 @@
const std = @import("std"); const std = @import("std");
const wlr = @import("wlroots"); const wlr = @import("wlroots");
const zlua = @import("zlua");
const Lua = zlua.Lua;
const Server = @import("server.zig"); const Server = @import("server.zig");
const gpa = std.heap.c_allocator; const gpa = std.heap.c_allocator;
@ -10,6 +13,11 @@ pub var server: Server = undefined;
pub fn main() !void { pub fn main() !void {
wlr.log.init(.err, null); 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", .{}); std.log.info("Starting mezzaluna", .{});
try server.init(); try server.init();