pyio.parse_lines - pytha-3d-cad/pytha-lua-api GitHub Wiki
Parses the lines of a text-file to a table of strings.
pyio.parse_lines(file)
| Parameter | Type | Description |
|---|---|---|
file |
file handle |
The file that should be read |
Return value
| Type | Description |
|---|---|
{ (string)* } |
A table of strings |
Example:
For example, a text file with the following content
# Sample file
Hello World
Pi = 3.14
would result in the following lua table
{ "# Sample file", "Hello World", "", "Pi = 3.14" }
Remarks:
The encoding of the text-file is automatically detected. UTF8, UTF8 with BOM, UTF16LE with BOM and ASCII are supported. If the encoding can be chosen freely, then one of the Unicode formats is recommended, preferably with BOM. For ASCII/Ansi there's a small risk that the automatic detection might still interpret the file as UTF-8.
For line endings, Windows and Unix line endings (CR+LF and LF) are equally supported.
Version Support:
Minimum PYTHA Version: V26