"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[8828],{5473:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>r,toc:()=>c});const r=JSON.parse('{"id":"XXTLanControl.lua/web-file/remove_line","title":"Remove A Single Line (LCC.web_file.remove_line)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/web-file/remove_line.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/remove_line","permalink":"/docs/en/XXTLanControl.lua/web-file/remove_line","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":240,"frontMatter":{"sidebar_position":240},"sidebar":"tutorialSidebar","previous":{"title":"Remove A Range Of Lines (LCC.web_file.remove_lines)","permalink":"/docs/en/XXTLanControl.lua/web-file/remove_lines"},"next":{"title":"Copy Files Or Directories (LCC.web_file.copy)","permalink":"/docs/en/XXTLanControl.lua/web-file/copy"}}');var l=i(4848),t=i(8453);const s={sidebar_position:240},o="Remove A Single Line (LCC.web_file.remove_line)",a={},c=[{value:"Signature",id:"signature",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,t.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.header,{children:(0,l.jsx)(n.h1,{id:"remove-a-single-line-lccweb_fileremove_line",children:"Remove A Single Line (LCC.web_file.remove_line)"})}),"\n",(0,l.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"line, err = LCC.web_file.remove_line(path, line_number, timeout?)\n"})}),"\n",(0,l.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["path",(0,l.jsx)(n.br,{}),"\n","String. File path."]}),"\n",(0,l.jsxs)(n.li,{children:["line_number",(0,l.jsx)(n.br,{}),"\n","Number. Line index to delete; positive numbers start at ",(0,l.jsx)(n.code,{children:"1"}),", negative values count from the end (",(0,l.jsx)(n.code,{children:"-1"})," is the last line), and ",(0,l.jsx)(n.code,{children:"0"})," means after the last line."]}),"\n",(0,l.jsxs)(n.li,{children:["timeout",(0,l.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,l.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["line",(0,l.jsx)(n.br,{}),"\n","String. Content that was removed; ",(0,l.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,l.jsxs)(n.li,{children:["err",(0,l.jsx)(n.br,{}),"\n","String or ",(0,l.jsx)(n.code,{children:"nil"}),". Error description when the call fails."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,l.jsxs)(n.blockquote,{children:["\n",(0,l.jsxs)(n.p,{children:["Convenience wrapper around ",(0,l.jsx)(n.code,{children:"remove_lines"})," returning the deleted text.",(0,l.jsx)(n.br,{}),"\n","See the parameter description above for line-number rules.",(0,l.jsx)(n.br,{}),"\n","Returns ",(0,l.jsx)(n.code,{children:"nil"})," when nothing is removed."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:'local line, err = LCC.web_file.remove_line("/config/list.txt", 1)\nif line then\n    print("Removed:", line)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(d,{...e})}):d(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>s,x:()=>o});var r=i(6540);const l={},t=r.createContext(l);function s(e){const n=r.useContext(t);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:s(e.components),r.createElement(t.Provider,{value:n},e.children)}}}]);