Extend lua expect() to also return matched string

This commit is contained in:
Martin Lund 2024-04-17 23:38:18 +02:00
parent 48c9e8a9a9
commit 3cc2d90fda
2 changed files with 18 additions and 2 deletions

View file

@ -375,6 +375,11 @@ In addition to the Lua API tio makes the following functions available:
Expect string - waits for string to match or timeout before continueing.
Supports regular expressions. Special characters must be escaped with '\\\\'.
Timeout is in milliseconds, defaults to 0 meaning it will wait forever.
Returns 1 on successful match, 0 on timeout, or -1 on invalid regular expression.
On successful match it also returns the match string as second return value.
.IP "\fBsend(string)"
Send string.
.IP "\fBmodem_send(file, protocol)"