刪除單行 (LCC.web_file.remove_line)
聲明
line, err = LCC.web_file.remove_line(path, line_number, timeout?)
參數
- path
字串型,目標檔案路徑 - line_number
數值型,要刪除的行號;正數從1起算,負數從末尾倒數(-1為最後一行),0表示末行之後 - timeout
數值型,可選;請求逾時時間(秒),預設60
回傳值
- line
字串型,被刪除的行內容;失敗時為nil - err
字串型或nil,失敗時的錯誤描述
說明
刪除指定行號的單行,並傳回該行原始文字。
行號規則詳見上方參數說明。
沒有刪除到內容時傳回nil。
範例
local line, err = LCC.web_file.remove_line("/設定/list.txt", 1)
if line then
print("移除: " .. line)
end