Add GetCombatLogPath/GetChatLogPath Lua functions, update log path globals

Register Lua functions to expose current log paths. At PLAYER_LOGIN,
overwrite COMBATLOGENABLED/CHATLOGENABLED globals with actual redirected
paths (English locale only). Update DLL_README with Lua API and logging
enable instructions.
This commit is contained in:
MarcelineVQ
2026-03-04 14:39:58 -08:00
parent 0c76c99734
commit 1bbf334958
4 changed files with 46 additions and 6 deletions
+25
View File
@@ -14,6 +14,7 @@
const std = @import("std");
const hook = @import("zhook");
const con = @import("../console.zig");
const lua = @import("../lua.zig");
const o = @import("offsets.zig");
const sc = std.builtin.CallingConvention{ .x86_stdcall = .{} };
@@ -475,6 +476,30 @@ pub fn onShutdown() void {
restorePathPointers();
}
// =============================================================================
// Lua API — log path accessors
// =============================================================================
/// GetCombatLogPath() → string or nil
pub fn luaGetCombatLogPath(L: lua.State) callconv(.c) u32 {
if (g_combat_path_len > 0) {
lua.pushstring(L, @ptrCast(g_combat_path[0..g_combat_path_len :0]));
} else {
lua.pushnil(L);
}
return 1;
}
/// GetChatLogPath() → string or nil
pub fn luaGetChatLogPath(L: lua.State) callconv(.c) u32 {
if (g_chat_path_len > 0) {
lua.pushstring(L, @ptrCast(g_chat_path[0..g_chat_path_len :0]));
} else {
lua.pushnil(L);
}
return 1;
}
// =============================================================================
// Install / remove hooks
// =============================================================================