Port:readline([eol]) 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"
.
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
local serial = require "serial"
local COM1 = serial.Port("COM1")
if COM1:open() then
repeat
local data = COM1:readline():wait()
if data then
print("Received line : ", data)
else
error("Error reading COM1 port");
end
until not data
end