Replays
phigrospp.replay.list(id, difficulty)
The replays of a chart on the device, in no particular order: each one's file and header (score, date...).
for _, replay in ipairs(phigrospp.replay.list("Glaciaxion.SunsetRay.0", "IN")) do print(replay.path, replay.header.score) end
| Parameter | Type | |
|---|---|---|
id | string | |
difficulty | Difficulty |
Returns { path: string, header: table }[]
phigrospp.replay.bests(list)
Of a chart's replays, the best for each set of modifiers, by its bits.
local best = phigrospp.replay.bests(phigrospp.replay.list(id, "IN")) print(best[0] and best[0].header.score) -- the best without modifiers
| Parameter | Type | |
|---|---|---|
list | table |
Returns table
phigrospp.replay.chunk(from)
The frames of the song being played after the first from, as a replay of their own, and how many there are now (nil, from when none is new): a play streams with it, Rooms sends one twice a second.
local sent = 0 every(0.5, function() local chunk, count = phigrospp.replay.chunk(sent) if chunk then send(chunk) sent = count end end)
| Parameter | Type | |
|---|---|---|
from | integer |
Returns string? (chunk)
Returns integer (count)
phigrospp.replay.follow(tag?)
Plays another player's stream in game as it comes, nil stops.
phigrospp.replay.follow("ggmolly#4141") on("leave", function() phigrospp.replay.follow(nil) end)
| Parameter | Type | |
|---|---|---|
tag? | string | "name#0042" |
phigrospp.replay.feed(data?)
Gives what follow plays each chunk(): the first starts its chart, feed() with nothing says the stream is over.
phigrospp.replay.follow("ggmolly#4141") socket = phigrospp.socket(url, { message = function(text) phigrospp.replay.feed(phigrospp.unbase64(text)) end, close = function() phigrospp.replay.feed() end, -- the stream is over })
| Parameter | Type | |
|---|---|---|
data? | string |
phigrospp.replay.button(icon, fn)
One more button in the replay player's row, with one of ui.icon's icons, running the function when tapped.
phigrospp.replay.button("skip-back", function() phigrospp.jump(math.max(0, phigrospp.replay.state().frames[phigrospp.replay.state().cursor].t - 5)) end)
| Parameter | Type | |
|---|---|---|
icon | Icon | |
fn | fun() |
phigrospp.replay.marks()
The goods, bads and misses of the replay being watched, in order, t in seconds into the chart.
for _, mark in ipairs(phigrospp.replay.marks()) do print(mark.t, mark.judgement) --> 42.5 miss end
Returns { t: number, judgement: Judgement }[]
phigrospp.replay.state()
The replay being watched, nil when none is: frames (each one's t is its song time) and cursor, the frame it's at.
local state = phigrospp.replay.state() if state then print(state.frames[state.cursor].t) end --> 61.25
Returns { frames: { t: number }[], cursor: integer }?
phigrospp.replay.takeover()
Stops watching: the song starts again for the player to play.
phigrospp.replay.button("play", phigrospp.replay.takeover) -- play on from where the replay is