lua api to interact with remote clients closes #10

This commit is contained in:
Squibid 2025-12-16 15:34:16 -05:00
parent d4a0abe762
commit 8e7423339c
Signed by: squibid
GPG key ID: BECE5684D3C4005D
2 changed files with 18 additions and 0 deletions

View file

@ -12,6 +12,7 @@ const Api = @import("Api.zig");
const Hook = @import("Hook.zig");
const View = @import("View.zig");
const Output = @import("Output.zig");
const Remote = @import("Remote.zig");
const gpa = std.heap.c_allocator;
@ -139,6 +140,11 @@ pub fn openLibs(self: *zlua.Lua) void {
LuaUtils.newLib(self, output_funcs);
self.setField(-2, "output");
}
{
const remote_funcs = zlua.fnRegsFromType(Remote);
LuaUtils.newLib(self, remote_funcs);
self.setField(-2, "remote");
}
}
}

12
src/lua/Remote.zig Normal file
View file

@ -0,0 +1,12 @@
const Remote = @This();
const std = @import("std");
const zlua = @import("zlua");
const LuaUtils = @import("LuaUtils.zig");
const RemoteLua = @import("../RemoteLua.zig");
pub fn print(L: *zlua.Lua) i32 {
RemoteLua.sendNewLogEntry(L.checkString(1));
return 0;
}