![Asentria Teleboss 850 Скачать руководство пользователя страница 169](http://html.mh-extra.com/html/asentria/teleboss-850/teleboss-850_user-manual_2981745169.webp)
TeleBoss 850 2.06.280_STD User Manual
Page 163
a_lib.GetCharacter
Description
Reads a single character from the device or socket. Returns immediately whether a character is available or not.
Syntax
a_lib.GetCharacter(handle)
handle: The handle obtained when the device or socket was opened
Returns
Character that was read, or 'nil' if no character available.
Example
-- prompt user
a_lib.SendString(handle, "Are you sure (y/n)? ")
-- wait for a character
repeat
char = a_lib.GetCharacter(handle)
until char ~= nil
-- if response is Yes
if char == 'y' or char == 'Y'
-- do stuff.....
end
a_lib.GetLine
Description
Reads a line of text from the device or socket. Returns when a line is received that is terminated by CR, or when
the timeout, if specified, is exceeded. The maximum size of the received line must be less than 128 characters.
Syntax
a_lib.GetLine(handle)
a_lib.GetLine(handle, timeout)
handle: The handle obtained when the device or socket was opened
timeout: How many milliseconds to wait for the incoming line;
will wait forever if timeout is not specified
Returns
Returns a string containing line that was read, not including the terminating CR. Returns 'nil' if a complete line was
not received before the timeout, or if more than 128 characters were received without a terminating CR.
Example
-- get line of input, timeout in 2 seconds
string = a_lib.GetLine(handle, 2000)
-- if we got something
if string ~= nil then
-- do stuff with it...
end
Содержание Teleboss 850
Страница 6: ......