1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-28 09:09:31 +00:00

[api] allow text event data grouping by tag

This commit is contained in:
Étienne Fildadut 2024-04-29 23:23:15 +02:00
parent 2a7e1a4be5
commit a3dded3935
7 changed files with 140 additions and 23 deletions

View file

@ -33,8 +33,13 @@ local function run_loop(run_state, write_output, interactive)
local e, data = run_state:step()
write_output("--- "..e.." ---")
if e == "text" then
for _, l in ipairs(data) do
write_output(l:format(run_state))
local grouped = data:group_by("group")
local groups = #grouped > 1
for _, v in ipairs(grouped) do
if groups then write_output(":: group ::") end
for _, l in ipairs(v) do
write_output(l:format(run_state))
end
end
elseif e == "choice" then
local choice