# serialRead(\[num])

@param num (optional): maximum number of bytes to read. If non-zero, serialRead will read up to num characters from the buffer. If 0 or left out, serialRead will read up to and including the first newline character or the end of the buffer. Note that the returned string may not end in a newline if this character is not present in the buffer.

Reads characters from the serial port. The string is allowed to contain any character, including 0.

@status current Introduced in 2.3.8

## Parameters

none

## Return value

* `str` string. Empty if no new characters were available.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://luadoc.edgetx.org/edgetx-v2.8/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialread.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
