"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[7246],{8453:(e,n,l)=>{l.d(n,{R:()=>r,x:()=>o});var i=l(6540);const s={},t=i.createContext(s);function r(e){const n=i.useContext(t);return i.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(s):e.components||s:r(e.components),i.createElement(t.Provider,{value:n},e.children)}},9717:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>d});const i=JSON.parse('{"id":"XXTLanControl.lua/web-file/get_lines","title":"\u8bfb\u53d6\u6587\u4ef6\u4e3a\u884c\u6570\u7ec4 (LCC.web_file.get_lines)","description":"\u58f0\u660e","source":"@site/docs/XXTLanControl.lua/web-file/get_lines.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/get_lines","permalink":"/docs/XXTLanControl.lua/web-file/get_lines","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":140,"frontMatter":{"sidebar_position":140},"sidebar":"tutorialSidebar","previous":{"title":"\u4e0a\u4f20\u8bbe\u5907\u6587\u4ef6\u5230\u4e2d\u63a7 (LCC.web_file.upload_file)","permalink":"/docs/XXTLanControl.lua/web-file/upload_file"},"next":{"title":"\u7edf\u8ba1\u6587\u4ef6\u884c\u6570 (LCC.web_file.line_count)","permalink":"/docs/XXTLanControl.lua/web-file/line_count"}}');var s=l(4848),t=l(8453);const r={sidebar_position:140},o="\u8bfb\u53d6\u6587\u4ef6\u4e3a\u884c\u6570\u7ec4 (LCC.web_file.get_lines)",c={},d=[{value:"\u58f0\u660e",id:"\u58f0\u660e",level:2},{value:"\u53c2\u6570",id:"\u53c2\u6570",level:2},{value:"\u8fd4\u56de\u503c",id:"\u8fd4\u56de\u503c",level:2},{value:"\u8bf4\u660e",id:"\u8bf4\u660e",level:2},{value:"\u793a\u4f8b",id:"\u793a\u4f8b",level:2}];function a(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,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"\u8bfb\u53d6\u6587\u4ef6\u4e3a\u884c\u6570\u7ec4-lccweb_fileget_lines",children:"\u8bfb\u53d6\u6587\u4ef6\u4e3a\u884c\u6570\u7ec4 (LCC.web_file.get_lines)"})}),"\n",(0,s.jsx)(n.h2,{id:"\u58f0\u660e",children:"\u58f0\u660e"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"lines, err = LCC.web_file.get_lines(path, timeout?)\n"})}),"\n",(0,s.jsx)(n.h2,{id:"\u53c2\u6570",children:"\u53c2\u6570"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["path",(0,s.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u8981\u8bfb\u53d6\u7684\u6587\u4ef6\u8def\u5f84"]}),"\n",(0,s.jsxs)(n.li,{children:["timeout",(0,s.jsx)(n.br,{}),"\n","\u6570\u503c\u578b\uff0c\u53ef\u9009\uff1b\u8bf7\u6c42\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u9ed8\u8ba4 ",(0,s.jsx)(n.code,{children:"60"})]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"\u8fd4\u56de\u503c",children:"\u8fd4\u56de\u503c"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["lines",(0,s.jsx)(n.br,{}),"\n","\u8868\u7c7b\u578b\uff0c\u6587\u4ef6\u5185\u5bb9\u6309\u884c\u7ec4\u6210\u7684\u6570\u7ec4\uff08\u7edf\u4e00\u6362\u884c\u7b26\u4e3a ",(0,s.jsx)(n.code,{children:"\\n"}),"\uff09\uff1b\u5931\u8d25\u65f6\u4e3a ",(0,s.jsx)(n.code,{children:"nil"})]}),"\n",(0,s.jsxs)(n.li,{children:["err",(0,s.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\u6216 ",(0,s.jsx)(n.code,{children:"nil"}),"\uff0c\u5931\u8d25\u65f6\u7684\u9519\u8bef\u63cf\u8ff0"]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"\u8bf4\u660e",children:"\u8bf4\u660e"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["\u8bfb\u53d6\u6587\u4ef6\u5168\u90e8\u5185\u5bb9\u5e76\u6309\u884c\u62c6\u5206\u4e3a\u6570\u7ec4\u3002",(0,s.jsx)(n.br,{}),"\n","\u8bfb\u53d6\u524d\u4f1a\u5148\u628a ",(0,s.jsx)(n.code,{children:"\\r\\n"})," \u7edf\u4e00\u8f6c\u6362\u4e3a ",(0,s.jsx)(n.code,{children:"\\n"}),"\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"\u793a\u4f8b",children:"\u793a\u4f8b"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:'local lines, err = LCC.web_file.get_lines("/\u914d\u7f6e/list.txt")\nif not lines then\n    error(err)\nend\nprint("\u5171\u6709", #lines, "\u884c")\n'})})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(a,{...e})}):a(e)}}}]);