Add Lua API tio.twrite's documentation and example

This commit is contained in:
yabu76 2026-02-22 16:40:57 +09:00
parent d5b4e7d881
commit a19bf0aa44
4 changed files with 44 additions and 6 deletions

22
examples/lua/twrite.lua Normal file
View file

@ -0,0 +1,22 @@
--
-- tio.twrite() uses output-mapping, output-delay and input-mode.
--
-- Input-mode HEX is very slow, so it has limited use.
--
-- This script sends
-- Hello.
-- This is Hex mode.
-- Bye.
--
tio.set_input_mode(tio.C.IM_NORMAL)
tio.twrite("Hello.\r\n")
tio.set_input_mode(tio.C.IM_HEX)
tio.twrite("5468697320697320486578206d6f64652e0d0a") -- "This is Hex mode."
tio.set_input_mode(tio.C.IM_LINE)
tio.twrite("Bye.\r\n")
tio.set_input_mode(tio.C.IM_NORMAL)