Remove A Range Of Lines (LCC.web_file.remove_lines)
Signature
removed, err = LCC.web_file.remove_lines(path, start_line, count?, timeout?)
Parameters
- path
String. File path. - start_line
Number. Starting line index; positive numbers start at1, negative values count from the end (-1is the last line), and0means after the last line. - count
Number, optional. Number of lines to remove, default1. - timeout
Number, optional. Request timeout in seconds, default60.
Returns
- removed
Table. Array of removed lines; returns{}when the request succeeds but nothing is removed, andnilon failure. - err
String ornil. Error description when the operation fails.
Notes
Removes several lines at once from the file.
See the parameter description above for line-number rules.
Missing files, out-of-range selections, orcount = 0all return{}.
The returned lines can be logged or used to build an undo stack.
Example
local removed, err = LCC.web_file.remove_lines("/config/list.txt", 2, 3)
if removed then
LCC.log(2, "Removed lines", table.concat(removed, ","))
end