Read A Single Line (LCC.web_file.get_line)
Signature
line, err = LCC.web_file.get_line(path, line_number, timeout?)
Parameters
- path
String. File path. - line_number
Number. Line index to read; positive numbers start at1, negative values count from the end (-1is the last line), and0means after the last line. - timeout
Number, optional. Request timeout in seconds, default60.
Returns
- line
String ornil. Text of the requested line; returns an empty string when the line is not found, andnilonly on failure. - err
String ornil. Only set when the call fails.
Notes
Built on top of
get_range_linesto fetch a single line.
Positive numbers start at1; negative values count from the end (-1is the last line);0means after the last line.
Returns an empty string when the specified line is not found.
Example
local line, err = LCC.web_file.get_line("/config/list.txt", 3)
if line then
print("Line 3: " .. line)
end