Skip to content

Search

Documentation

replay module

Records what a running game is fed and plays it back. A recording holds each tick's input, network arrivals and events; balaur run --record writes one.

Auf dieser Seite

Records what a running game is fed and plays it back. A recording holds each tick's input, network arrivals and events; balaur run --record writes one.

17 functions, 4 constants. Scripts reach it as replay::.

Functions

Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.

function acts on what it does
divergence_tick() — The first tick whose replay did not reproduce the recorded digest, or nil.
events(from: int, to: int) — The events recorded between two ticks, each with its tick, kind, label and data.
header() — The loaded recording's project, start time, script fingerprint and how it ended.
info(path: string) — The same summary for a recording on disk, without loading it.
length() — The loaded recording's frame count and the ticks it spans, or nil.
load(path: string) — Read a recording and put it in front of the engine, paused before its first tick.
marks(source: string, key: string?) — The ticks at which one replay source held a non-empty list under a key, and what it held.
pause() — Stop between ticks, holding the simulation still while the frame loop keeps drawing.
play() — Run the loaded recording, one recorded tick per frame.
position() — The tick playback has reached.
record(path: string, options: any?) — Start recording into a file; call it before the code it records runs.
recording() — The file being recorded into, or nil.
recording_name() — A file-safe name for a recording starting now, so a list of them sorts by when they ran.
seek(tick: int) — Run recorded ticks until playback reaches the given tick; forward only.
state() — What playback is doing: STATE_STOPPED, STATE_PLAYING, STATE_PAUSED or STATE_SEEKING.
stop(reason: string?) — Close the recording, naming why it ended, and return the file it wrote.
unload() — Drop the loaded recording and let the game run live again.

Constants

name value
STATE_PAUSED paused
STATE_PLAYING playing
STATE_SEEKING seeking
STATE_STOPPED stopped