Skip to content

Commit 719e3ff

Browse files
committed
feat(log): add types for log module
1 parent e38cbd4 commit 719e3ff

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/lua/types.lua

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
---@field stake? number The stake level (optional)
3636
---@field seed? string The seed for the run (optional)
3737
---@field challenge? string The challenge name (optional)
38+
---@field log_path? string The full file path for the run log (optional, must include .jsonl extension)
3839

3940
-- =============================================================================
4041
-- Game Action Argument Types (used in api.lua)
@@ -226,10 +227,25 @@
226227
-- Log Types (used in log.lua)
227228
-- =============================================================================
228229

230+
---@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+
236+
---@class PendingLog
237+
---@field log_entry table The log entry data to be written when condition is met
238+
---@field condition function Function that returns true when the log should be written
239+
240+
---@class FunctionCall
241+
---@field name string The name of the function being called
242+
---@field arguments table The parameters passed to the function
243+
229244
---@class LogEntry
230245
---@field timestamp_ms number Timestamp in milliseconds since epoch
231-
---@field function {name: string, arguments: table} Function call information
232-
---@field game_state G Game state at time of logging
246+
---@field function FunctionCall Function call information
247+
---@field game_state_before G Game state before function call
248+
---@field game_state_after G Game state after function call
233249

234250
-- =============================================================================
235251
-- Configuration Types (used in balatrobot.lua)

0 commit comments

Comments
 (0)