Skip to content

Commit 4bbe051

Browse files
S1M0N38claude
andcommitted
fix(log): update type definitions to match implementation
- Fix Log class field names and function signatures - Change previous_game_state to game_state_before - Add missing schedule_write function declaration - Update LogEntry with timestamp_ms_before/after fields - Make optional fields properly typed as nullable Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4cdad00 commit 4bbe051

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/lua/types.lua

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,14 @@
228228
-- =============================================================================
229229

230230
---@class Log
231-
---@field mod_path? string Path to the mod directory for log file storage
232-
---@field current_run_file? string Path to the current run's log file
233-
---@field pending_logs? table<string, PendingLog> Map of pending log entries awaiting conditions
234-
---@field previous_game_state? G Game state before function call
235-
---@field init fun(self: Log) Initializes the logger by setting up hooks
236-
---@field write fun(self: Log, original_function: function, function_call: FunctionCall, ...) Writes a log entry to the JSONL file
237-
---@field update fun(self: Log) Processes pending logs by checking completion conditions
231+
---@field mod_path string? Path to the mod directory for log file storage
232+
---@field current_run_file string? Path to the current run's log file
233+
---@field pending_logs table<string, PendingLog> Map of pending log entries awaiting conditions
234+
---@field game_state_before G Game state before function call
235+
---@field init fun() Initializes the logger by setting up hooks
236+
---@field write fun(log_entry: LogEntry) Writes a log entry to the JSONL file
237+
---@field update fun() Processes pending logs by checking completion conditions
238+
---@field schedule_write fun(function_call: FunctionCall) Schedules a log entry to be written when condition is met
238239

239240
---@class PendingLog
240241
---@field log_entry table The log entry data to be written when condition is met
@@ -245,10 +246,11 @@
245246
---@field arguments table The parameters passed to the function
246247

247248
---@class LogEntry
248-
---@field timestamp_ms number Timestamp in milliseconds since epoch
249+
---@field timestamp_ms_before number Timestamp in milliseconds since epoch before function call
250+
---@field timestamp_ms_after number? Timestamp in milliseconds since epoch after function call
249251
---@field function FunctionCall Function call information
250252
---@field game_state_before G Game state before function call
251-
---@field game_state_after G Game state after function call
253+
---@field game_state_after G? Game state after function call
252254

253255
-- =============================================================================
254256
-- Configuration Types (used in balatrobot.lua)

0 commit comments

Comments
 (0)