Port:readline([eol], [capacity])method
Reads data until a End Of Line character sequence is reached.
Parameters
[eol]
A string indicating the End Of Line characters sequence, defaulting to "\n".
[capacity]
An optional number indicating the capacity of the internal read buffer, defaulting to 1024.
Return value
Returns a Task object to perform the read operation asynchronously.Once the Task has terminated, it will return a Buffer that contains the data, or
false in case of error.
Example
--! luart-extensions
import serial
local COM1 = serial.Port("COM1")
if COM1:open() then
repeat
local data = await COM1:readline()
if data then
print("Received line : ", data)
else
error("Error reading COM1 port");
end
until not data
end