mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 08:39:30 +00:00
[api] add LuaText and document built-in event data
This commit is contained in:
parent
876135401c
commit
77c6ac6ba2
10 changed files with 391 additions and 49 deletions
|
|
@ -38,14 +38,14 @@ local function run_loop(run_state, write_output, interactive)
|
|||
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))
|
||||
write_output(l.raw:format(run_state))
|
||||
end
|
||||
end
|
||||
elseif e == "choice" then
|
||||
local choice
|
||||
if interactive then
|
||||
for i, l in ipairs(data) do
|
||||
write_output(("%s> %s"):format(i, l:format(run_state)))
|
||||
write_output(("%s> %s"):format(i, l.raw:format(run_state)))
|
||||
end
|
||||
io.write(("Select choice (1-%s): "):format(#data))
|
||||
choice = tonumber(io.read("l"))
|
||||
|
|
@ -53,9 +53,9 @@ local function run_loop(run_state, write_output, interactive)
|
|||
choice = assert(run_state:eval_local("choice"), "no choice selected"):to_lua()
|
||||
for i, l in ipairs(data) do
|
||||
if i == choice then
|
||||
write_output(("=> %s"):format(l:format(run_state)))
|
||||
write_output(("=> %s"):format(l.raw:format(run_state)))
|
||||
else
|
||||
write_output((" > %s"):format(l:format(run_state)))
|
||||
write_output((" > %s"):format(l.raw:format(run_state)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue