Overhaul Lua API

Lua API moved into a tio library table and names adjusted to Lua stdlib style.
Regex in expect() replaced with Lua patterns so binary data can be handled.
New tio.alwaysecho variable allows enabling and disabling echo to console.
Read and write functions now manage complex retry and timeout logic internally,
giving the user a simple "nil if fail" API like the rest of Lua.
exit() was removed, os.exit() already exists in the Lua standard library.
This commit is contained in:
ii8 2025-06-13 15:49:33 +01:00
parent 8f33cff6ea
commit 114b69b68a
9 changed files with 318 additions and 465 deletions

View file

@ -1,14 +1,14 @@
read(1000, 6000) -- initial config
write("\n")
msleep(100)
read(650, 60) -- main menu
write("S") -- S menu
msleep(30)
read(650, 60)
write("t") -- Parallel Value Table
read(650, 60)
tio.read(1000, 6000) -- initial config
tio.write("\n")
tio.msleep(100)
tio.read(650, 60) -- main menu
tio.write("S") -- S menu
tio.msleep(30)
tio.read(650, 60)
tio.write("t") -- Parallel Value Table
tio.read(650, 60)
while true do
msleep(1000)
write("t")
read(650, 50) -- repeat PVT forever
tio.msleep(1000)
tio.write("t")
tio.read(650, 50) -- repeat PVT forever
end