mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
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:
parent
381c0b7823
commit
86f48a2fb6
9 changed files with 318 additions and 465 deletions
|
|
@ -1,17 +1,15 @@
|
|||
read(1000, 8000) -- read initial config
|
||||
write("\n")
|
||||
read(650, 100) -- main menu
|
||||
write("S") -- S menu
|
||||
n = 1
|
||||
while n > 0 do -- while not empty, read more
|
||||
n, str = read_line(25)
|
||||
end
|
||||
tio.read(1000, 8000) -- read initial config
|
||||
tio.write("\n")
|
||||
tio.read(650, 100) -- main menu
|
||||
tio.write("S") -- S menu
|
||||
repeat
|
||||
str = tio.readline(25)
|
||||
until str == nil
|
||||
while true do
|
||||
write("t") -- query PV table
|
||||
msleep(880)
|
||||
n = 1
|
||||
while n > 0 do -- while not empty, read more
|
||||
n, str = read_line(60)
|
||||
msleep(60)
|
||||
end
|
||||
tio.write("t") -- query PV table
|
||||
tio.msleep(880)
|
||||
repeat
|
||||
str = tio.readline(60)
|
||||
tio.msleep(60)
|
||||
until str == nil
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue