Revert "Add multipul patterns function to Lua API tio.expect()"

This reverts commit d1ff5f7142.
This commit is contained in:
yabu76 2025-11-02 09:50:44 +09:00
parent 67bd6b1a8c
commit b5944275d3

View file

@ -58,22 +58,15 @@ static char script_init[] =
"end\n"
"tio.expect = function(pattern, timeout)\n"
" local str = ''\n"
" if type(pattern) ~= 'table' then\n"
" pattern = { pattern }\n"
" end\n"
" while true do\n"
" local idx, pat\n"
" local c = tio.read(1, timeout)\n"
" if c then\n"
" str = str .. c\n"
" for idx, pat in ipairs(pattern) do\n"
" local matched = { string.match(str, pat) }\n"
" if matched[1] then\n"
" return matched, str, idx\n"
" end\n"
" if string.match(str, pattern) then\n"
" return string.match(str, pattern)\n"
" end\n"
" else\n"
" return nil, str, 0\n"
" return nil, str\n"
" end\n"
" end\n"
"end\n"